Hi guys,
I am using the OLIMEX MSP430-169LCD board based on MSP430F169 Uc.
I had just started the programming part and wanted to control the LED on Port 2(pin1) OR P2.1.
I wrote a simple program which is not working :
#include <io430x16x.h>
int main( void )
{
WDTCTL = WDTPW + WDTHOLD;
P2OUT &= ~BIT1; // low
P2DIR |= BIT1; // output
return 0;
}
The code is going under the debugging mode but the LED is not lighting.
My Hardware is working fine as the Demo LCD code which lights UP the LEd, when loaded is working fine.
can you please advise where I am going wrong?
Regards,
pranay
gm
2
That should work but perhaps the problem is that your main() function is returning which it should not in an embedded system. Try this code:
#include <msp430.h>
void main (void)
{
WDTCTL = WDTPW | WDTHOLD;
P2OUT &= ~BIT1; // LED enabled low
P2DIR |= BIT1; // make P2.1 an output
for (;;) {} // wait here forever
}
Hope this helps,
gm
The code you gave is working .Thx a lot for your time :roll:
in fact it is working even without the for loop.
Being a beginner I was following this link :
http://referencedesigner.com/tutorials/ … 430_04.php
which had in its code return(0)
Thx again mate
Tk care