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.

timer a interruption



Hello, I have a problem with the following code:


#include  <msp430xG43x.h>

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
 
  TACTL |= TACLR;
  TAR = 0;
 
  P5DIR |= 0x02;                            // P5.1 output
  TACCTL0 = CCIE;                             // CCR0 interrupt enabled
  TACCR0 = 50000;
 TACTL = TASSEL_1 + MC_1+TAIE;    // ACLK, UP MODE,TIMER A interrupt enabled
 
  while(1)
  {
  _BIS_SR(LPM0_bits + GIE);                 // Enter LPM0 w/ interrupt
 
  }
}

// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
    _BIC_SR(LPM3_bits);                   // Clear LPM3 bits from 0(SR)
  P5OUT ^= 0x02;                            // Toggle P5.1
__delay_cycles(65536);
  CCR0 += 50000;                            // Add Offset to CCR0

}

 

I don't have any problem when I try to compile it, but at the debugger it never enters  the interruption. I have noticed that the TAR never increments its value, so it never reaches TACCR0. I have also tried to use the SMCLK clock, but nothing changes.  I don't know how to solve this problem

Thank you in advanced for your help.

**Attention** This is a public forum