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.

Clock Divider combination ID+IDEX

Hello Dear,

We need a clock interrupt of 1sec. We have out the timer configuration as follows on MSP430F5137

1. Clock source = ACLK (32K)

2. Clock Div = 3.  (Div by 8).  TA1CTL |= ID_3;

3. Count = 4K

This will suffice. But when I am trying to use TAIDEX Bits along with ID bits to get bigger clock divide and smaller count nuber number, it is failing to give interrupt.

If we use this setting

TA1CTL |= ID_3+TAIDEX_3;

Is it fair to assume that now input clock source will be divided by 8 initially by ID_3 which makes clock 4K. And then TAIDEX_3 will further divide this 4K clock by 4

which makes timer clock 1KHz clock.

If we put count = 1K now , then it will produce same 1sec interrupt.

But we are not seeing any interrupt. Whats the problem ? How could we use these two dividers in combinations ?

Example code Code :

int main(void)
{
      WDTCTL = WDTPW + WDTHOLD; // Stop WDT
       P2DIR |= BIT6; // P2.6 output

      TA1CCTL0 = CCIE; // CCR0 interrupt enabled

      TA1CTL |= TACLR; //clear TAR
      TA1CTL |= TASSEL_1 ; //ACLK
      TA1CTL |= ID_3+TAIDEX_3; //Clock Divider (by 8)
                       // TA1CTL |= TAIDEX_0; //Extended Clock Divider (by 0). Setting this bit other than 0 is causing timer to stop.
      TA1CTL |= MC_1; //Mode Control ( Upmode)
      TA1CCR0 = 10;
      TA1CTL |= TACLR; //clear TAR

      __bis_SR_register(LPM3_bits + GIE); // Enter LPM3, enable interrupts
      __no_operation(); // For debugger
}

// Timer A0 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER1_A0_VECTOR))) TIMER1_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
    P2OUT ^= BIT6; // Toggle P1.0
}

 

**Attention** This is a public forum