//****************************************************************************** // MSP430x4xx Demo - Software Toggle P5.1 // // Description; Toggle P5.1 by xor'ing P5.1 inside of a software loop. // ACLK = n/a, MCLK = SMCLK = default DCO // // MSP430x4xx // ----------------- // /|\| XIN|- // | | | // --|RST XOUT|- // | | // | P5.1|-->LED // // A. Dannenberg // Texas Instruments, Inc // January 2006 // Built with CCE for MSP430 Version: 3.0 //****************************************************************************** #include "msp430f412.h" int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P5DIR |= 0x02; // Set P5.1 to output direction for (;;) { volatile unsigned int i; // volatile to prevent optimization P5OUT ^= 0x02; // Toggle P5.1 using exclusive-OR i = 10000; // SW Delay do i--; while (i != 0); } }