This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to use timer A to generate interrupt every 1 second continuously for an hour

Other Parts Discussed in Thread: MSP430F5635

Hi

I am using MSP430F5635.

I want to create timer interval for 1 second .

I have posted the code below .

The ISR has to blink the LED every 1 second . but this is not working .

Please help me out .

Thanks in advance.

Jenitta

This is my code .

void timer_init()

{

TA1CCTL0 = CCIE;

TA1CTL = TASSEL_1 + MC_1 + TACLR + TAIE;

TA1CCR0 = 32768;

}

#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
{
 P1OUT ^= BIT4; // blink my led

}

  • There are lots of other threads talking about exactly the same issue. Please use the forum search function.

    Anyway: you set the TAIE bit, which enables the timer overflow interrupt on TIMER1_A1_VECTOR, for which you don't have an ISR. So as soon as your CCR0 interrupt has fired, a timer overflow is fired and resets the MSP. I'd say, your LED is flashing for a few microseconds before it gets reset.

**Attention** This is a public forum