This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Priodic Timer on LPC2368

I am using LPC2368 with RTX kernel .

I need to run a timer interrupt after a specific time interval again and again as scanning’s routine. I initiate the timer to generate the interrupt.

void timer_init(void)
{ /* Setup Timer Counter 0: Periodic Timer with Interrupt */ T0MR0 = 1499999; /* TC0 Match Value 0 */ T0MCR = 3; /* TCO Interrupt and Reset on MR0 */ T0TCR = 1; /* TC0 Enable */

/* Setup Timer Counter 0 Interrupt */ VICVectAddr4 = (unsigned long)tc0_isr; /* TC0 Interrupt -> Vector 4 */ VICVectCntl4 = 0x02; /* TC0 Interrupt -> Priority 2 */ VICIntEnable = 1 << 4; /* Enable TC0 Interrupt */}

__irq void tc0_isr (void)
{

// code here

T0IR = 1; // Clear interrupt flag
VICVectAddr = 0; // Acknowledge Interrupt
}

When I debug the above code.. the timer interrupt is run the first time. but
not after that . What do i need to change so that the timer interrupt runs periodically again and again

Parents
  • Sorry about the mess here is the code

    void timer_init(void){

    /* Setup Timer Counter 0: Periodic Timer with nterrupt */

    T0MR0 = 1499999;
    T0MCR =3;
    T0TCR = 1;

    /* Setup Timer Counter 0 Interrupt */
    VICVectAddr4 = (unsigned long)tc0_isr;

    VICVectCntl4 = 0x02
    VICIntEnable = 1 << 4;

    }

    __irq void tc0_isr (void){

    // code here

    T0IR = 1; // Clear interrupt flag
    VICVectAddr = 0; // Acknowledge Interrupt
    }

Reply
  • Sorry about the mess here is the code

    void timer_init(void){

    /* Setup Timer Counter 0: Periodic Timer with nterrupt */

    T0MR0 = 1499999;
    T0MCR =3;
    T0TCR = 1;

    /* Setup Timer Counter 0 Interrupt */
    VICVectAddr4 = (unsigned long)tc0_isr;

    VICVectCntl4 = 0x02
    VICIntEnable = 1 << 4;

    }

    __irq void tc0_isr (void){

    // code here

    T0IR = 1; // Clear interrupt flag
    VICVectAddr = 0; // Acknowledge Interrupt
    }

Children
No data