Two LEDs fade in and out. The C code uses loops within loops to create a pulse with a set frequency and cycling duty cycle.
The ez430 dongle had been cut to expose the headers that I soldered to the target board.
Simple stuff, but you have to start somewhere.
Here is the code that I wrote and debugged with CCS4, feel free to pick holes in it:
#include "msp430f2101.h"
int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= 0x02;
P1DIR |= 0x04;
for (;;)
{ volatile unsigned int i; volatile unsigned int n; n = 256; do{ n = n - 4; P1OUT = 0x00; i = 256; do{ i--; if (i - n){ P1OUT = 0x02; } else { P1OUT = 0x04; } } while (i != 0); } while (n != 0); do{ n = n + 4; P1OUT = 0x00; i = 256; do{ i--; if (i - n){ P1OUT = 0x02; } else { P1OUT = 0x04; } } while (i != 0); } while (n != 256);
}
}
good effort! keep it up!!
roringar 3 weeks ago