We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
I haven't checked the interrupt handling of the LPC2103 - does the startup file hide any interrupt handling?
If not, I would expect you to make use of the __irq keyword:
void tc0ISR(void) __irq { ... }