SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By thermald
#78809
I'm having some issues trying to get a simple "flashing the LED" program running. Here's my code:
Code: Select all
unsigned int delay ( unsigned int x)
{
unsigned int i,j;
for (i = 0; i<= x; i++)
{
for(j=0;j<=1000; j++)
;
}
return 0;
}

#include "msp430x20x3.h"

void main( void )
{
  P1DIR |= 0x01;
  P1SEL &= 0xFE;
for (;;)
{
P1OUT ^= BIT0 ; 
delay(65535);

}

}
This results in the LED attached to P1.0 flickering at about 18Hz. I tried to slow it down by adding many more calls of delay(65535); but it doesn't change the flashing rate.
By OldCow
#78814
Try this:
Code: Select all
#include "msp430x20x3.h"
void main( void )
{
  P1DIR |= BIT0;
  P1OUT ^= BIT0 ;
} 
Does the LED blink at the same rate?
Hint: How long does the WDT expire?