#include #define UP 0x0010 // Set MC bits to enable TimerA UP mode #define ACLK 0x0100 // Configure TimerA to use the aux clock #define TIME_LIMIT 5000 // Timer limit #define RED_LED 0x0001 #define WDT_OFF 0x5A80 #define ENABLE_PINS 0xFFFE #define TA_INT_FLAG 0x0001 // TimerA_0 CTL Register bit interrupt flag // Raised by the timer when it reached its count main() { WDTCTL = WDT_OFF; // Disable watchdog PM5CTL0 = ENABLE_PINS; // Enable I/O pins TA0CCR0 = TIME_LIMIT; // Set Capture/Compare Register to the number we want the // timer to count. The timer compares its count with the number stored here. TA0CTL = ACLK | UP; // Setup TimerA_0 to UP mode P1DIR = RED_LED; // Set P1.0 pin as output while (1) { if (TA0CTL & TA_INT_FLAG) { P1OUT ^= RED_LED; // Reset timer by disabling its interrupt flag TA0CTL &= ~TA_INT_FLAG; } } }