//****************************************************************************** // MSP430G2xx2 Demo - WDT, Toggle P1.0, Interval Overflow ISR, DCO SMCLK // // Description: Toggle P1.0 using software timed by the WDT ISR Toggle rate // is approximately 30ms based on default DCO/SMCLK clock source // used in this example for the WDT // ACLK = n/a, MCLK = SMCLK = default // // MSP430G2xx2 // // /|\| XIN|// | | | // |RST XOUT|// | | // | P1.0| >LED // // D Dang // Texas Instruments Inc // December 2010 // Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10 //****************************************************************************** #include void main(void) { WDTCTL = WDT_MDLY_32; ~30ms IE1 |= WDTIE; P1DIR |= 0x01; } _BIS_SR(LPM0_bits + GIE); // Set Watchdog Timer interval to // Enable WDT interrupt // Set P1.0 to output direction // Enter LPM0 w/ interrupt // Watchdog Timer interrupt service routine #pragma vector=WDT_VECTOR interrupt void watchdog_timer(void) { P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR }