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 interrupt with emulator

Hi

I have difficulties running timer 0 code in the emulator. Im building it for the LPC2103 MCU.
Im using timer 0 to generate an interrupt every 10 ms. On the interrupt I incrment a variable.
But if I run this code in the emulator, the ISR function is called the first time the match channel is reached.
After that the ISR function isnt called anymore. Even though the T0IR is set, VICVectAddr has the adress of my ISR loaded. The other register look fine.

// Setup the Timer Counter 0 interrupt
void init_timer (void)
{
    T0MR0 = 149999;
    T0MCR = 3; // Interrupt and Reset on MR0
    T0TCR = 1; // Timer0 Enable
    VICVectAddr0 = (unsigned long)t0ISR;
    VICVectCntl0 = 0x20 | 4;// Timer 0 Interrupt
    VICIntEnable = 0x00000010;
}


void tc0ISR (void)
{
    timeval++;
    T0IR = 1; // Clear interrupt flag
    VICVectAddr = 0; // Acknowledge Interrupt
    // Never called again, but the T0IR is set, the
    // VICVectAddr is loaded with the ISR vector
}

.
Is it something with the emulator??
I use RL-MDK Basic version 3.23

/Thomas

0