Hello,
Using the following setup: µC: LPC2387 dev. tool: Keil µVision4 RL-FlashFS file system (SD card) runs on the µC.
I've got the 2 following problems:
Problem 1: My code is supposed to execute EXTINT0_IRQHandler() on every rising edge of a 1Hz square wave present at pin P2.10_EINT0. Then, after a delay defined by T1MR0, T1_IRQHandler() is to be executed.
The expected behaviour is therefore an execution frequency of EXTINT0_IRQHandler() of 1Hz and the same execution frequency for T1_IRQHandler() with a delay defined by T1MR0.
Although a correct execution frequency of EXTINT0_IRQHandler() is verified with a blinking LED, T1_IRQHandler() is not reached. After several minutes however, LED 5 eventually turns on. Do you have any idea?
Problem 2: The µC doesn't start correctly after reset when the interrupt pin was low. Any idea? This would be a great help.
Thanks in advance!
void init() { int toggle_extint=0; // init. external interrupt PINSEL4 |= (1<<20); EXTMODE =(1<<0); EXTPOLAR =(1<<0); VICVectAddr14 = (unsigned long)EXTINT0_IRQHandler; VICVectPriority14=14; VICIntEnable |= (1<<14); // init. timer 1; don't start T1MR0 = 20; T1MCR |=(1<<MR0I)|(1<<MR0R); T1TCR = 0; VICVectAddr5 = (unsigned long)T1_IRQHandler; VICVectPriority5 = 15; VICIntEnable |= (1 << TIMER1); } __irq void EXTINT0_IRQHandler(void) { EXTINT = 1; // LED blinks -> interrupt is executed as expected if(toggle_extint) { toggle_extint=0; led_on(2); } else { toggle_extint=1; led_off(2); } T1TCR = 1; // timer 1 is enabled here! IOSET0 = (1 << 16); VICVectAddr=0; } __irq void T1_IRQHandler (void) { led_on(5); // PROBLEM: LED never switches on, code is never reached! T1TCR = 0; // Timer1 disable // do something... T1IR = 1; // Clear interrupt flag VICVectAddr = 0; }