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.

cc1111 Timer4 interrupt

I have the cc1111 timer4 set up as follows:

clock 24MHz

timer tick using prescalar 128

  // f=187500Hz/64/5=3kHz/5 --> 1.7ms / IRQ
  T4CCTL0 = 0x44;
  T4CC0 = 0x04;
  T4CTL = 0xDE;
  INT_ENABLE(INUM_T4, INT_ON);
Now here is the issue, changing T4CC0 or T4CCTL0 prescalar or even the clock frequency does not seem to change the interrupt frequency.... I am trying to space the interrupts by approx 30 seconds and cannot seem to achieve that no matter what? What am I doing wrong? I am also clearing the interrupt flag in the interrupt routine as follows:
#pragma vector=T4_VECTOR
__interrupt void timer4_ISR(void)
{

  // Clear IRQ flag
  TIMIF &= ~BIT3;
}
Fahd
  • Hi

    Please take a look at the Timer 3 example found here: http://www.ti.com/lit/zip/CWRC117

    I just modified the example to use Timer 4 instead of Timer 3 (just replaced all 3’s with 4’s in the reg name + the Interrupt).

     

    #pragma vector = T4_VECTOR

    __interrupt void t4_isr(void) {

        /* Clears the module interrupt flag. */

        T4OVFIF = 0;

     

        /* Toggles the green LED. */

        P1_0 ^= 1;

     

       /* Clears the CPU interrupt flag. */

        T4IF = 0;

    }

     

    int main(void) {

       

        /* Initialize P1_1/3 for SRF04EB LED1/3 */

        P1SEL &= ~(BIT3 | BIT0);

        P1_0 = 1; P1_3 = 1;

        P1DIR |= (BIT3 | BIT0);

     

        /* Clock control. Configures the Timer tick speed setting, resulting in a

         * Timer tick frequency of 203.125 kHz.

         */

        CLKCON = (CLKCON & ~CLKCON_TICKSPD) | TICKSPD_DIV_128;

     

        /* Timer 4 channel 0 compare value.

         */

        T4CC0 = 0xFF; // Changing this value will change the freq. of toggling the green LED

     

        /* Timer 4 control. Configuration:

         * - Prescaler divider value: 128.

         * - Interrupts enabled.

         * - Modulo mode.

         * The Timer is also cleared and started.

         */

        T4CTL = T4CTL_DIV_128 | T4CTL_START | T4CTL_OVFIM |

            T4CTL_CLR | T4CTL_MODE_MODULO;

     

        /* Enables global interrupts (IEN0.EA = 1) and interrupts from Timer 3

         * (IEN1.T3IE = 1).

         */

        EA = 1;

        T4IE = 1;

     

        /* Infinite loop. */

        while (1);

     

        return 0;

    }

    BR

    Siri