I am trying to understand if i missed something here, I am not getting the interrupts
All i am trying to do is just generate a 1ms interrupt.
#include <msp430.h>
#define LED_PDIR P1DIR
#define LED_POUT P1OUT
#define LED_PIN BIT0
#ifdef __MSP430G2553__
#define EN_TIMER_INT TACTL |= TAIE // Enable timer interrupt
#define DIS_TIMER_INT TACTL &= ~TAIE // Disable timer interrupt
#endif
#define TICKS_PER_SECOND 1000000
#define TICKS_PER_MSECOND (TICKS_PER_SECOND/1000) // Base Time: 1 ms
void ConfigTimerA(unsigned int delayCycles)
{
TACCTL0 |= CCIE; //Enable Interrupts on Timer
TACCR0 = delayCycles; //Number of cycles in the timer
TACTL |= TASSEL_1; //Use ACLK as source for timer
TACTL |= MC_1; //Use UP mode timer
EN_TIMER_INT ;
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A0(void)
{
LED_POUT ^= LED_PIN; //Toggle the LED
}
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
LED_PDIR |= 0x01; // Set P1.0 to output direction
BCSCTL1 = CALBC1_1MHZ; // Set DCO to calibrated 1 MHz.
DCOCTL = CALDCO_1MHZ;
ConfigTimerA(TICKS_PER_MSECOND );
while (1)
{
LPM0;
GIE;
}
return 0;
}