Other Parts Discussed in Thread: MSP430F169
MCU: MSP430F169
ACLK: 32768 Hz
I am trying to use the TimerA module to create interrupts every 1 second. I have the following code but it does not seem to work the way I expect. I set the Timer on continueos mode and set TAR = 0xFFFF - 512. I should get a 1 second interrupt every 512 clock cycles.
Here are snippets of my code, please advice!
void Init_TimerA0(void)
{
TAR = 65535 - 512; // 1 second => Timer will overflow
TACTL = TASSEL_1+ID_3+MC_2; // ACLK + ACLK/8 + Continuous up count
return;
}
void Enable_TimerA0(void)
{
TACTL |= TAIE;
//TACCTL0 |= CCIE;
return;
}
#pragma vector = TIMERA1_VECTOR
__interrupt void TIMERA1ISR(void)
{
TACTL &= ~TAIE;
TACTL |= TACLR;
P2OUT ^= P2OUT_1; // Turn LED ON
Init_TimerA0(); // Also called before while(1) loop!
return;
}