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

Timer 0 Interrupt runs only once

Hello,

My interrupt routine runs only once and then it stops.
I don't know what to do, I googled for help but no success. Can anyone help me with this ?

I am using keil uVision3 and LPC2364

My code is below:

__irq void timer0_irq (void);


void INIT_TIMER(int seconds)
{
        int counter_timer;
        counter_timer=seconds*20000000;

        PCONP |= (1 << 1);
        T0MR0 = counter_timer;
        T0MCR =3;
        T0TCR = 2;
        T0TCR = 0;
        T0TCR = 1;

        VICVectAddr4 = (unsigned long)timer0_irq;
        VICVectCntl4 = 0x02;
        VICIntEnable |= 1 << 4;
}

int main()
{
        LED_DEBUG_ON();
        DELAY_MS(250);
        LED_DEBUG_OFF();
        DELAY_MS(250);

        INIT_TIMER(10); //10 seconds timer
        for(;;);
}

void timer0_irq()__irq
{
        LED_DEBUG_ON();
        T0IR = 1; // Clear interrupt flag
        VICVectAddr = 0; // Acknowledge Interrupt
}

Thanks in advance

0