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 there, I have 2 IRQ related ISR's in the program shown below. ISR's 1 and 2 do the task of making an LED (connected to P2.0 and P2.7) on and off. Iam seeing that when ISR1 is in execution(which is invoked by pressing a switch connected to P2.10 meant as external interrupt 0) and if ISR2 is invoked(which is invoked by pressing a switch connected to P2.11 meant as external interrupt 1) during that time, after completion of ISR1, the control branches to ISR2. Could anyone please suggest a method to prevent this.
#include <LPC23xx.H> void wait(void){ unsigned int i,j; for(i=0;i<=100;i++) for(j=0;j<=60000;j++); } /* External ISR 1 */ __irq void eint0_handler (void) { FIO2PIN = 0x00000001; wait(); FIO2PIN = 0x00000000; EXTINT = 0x00000001; VICVectAddr = 0; } /* External ISR 2 */ __irq void eint1_handler (void) { FIO2PIN = 0x00000080; wait(); FIO2PIN = 0x00000000; EXTINT = 0x00000002; VICVectAddr = 0; } /* Initialize External Interrupts EINT 0/1 */ void init_eint (void) { EXTMODE = 0x00000003; // Edge sensitive mode EXTPOLAR = 0x00000000; // Active low, Falling edge VICIntSelect = 0x00000000; VICVectAddr14 = (unsigned long) eint0_handler; VICVectAddr15 = (unsigned long) eint1_handler; VICVectPriority14 = 0; VICVectPriority15 = 1; VICIntEnable = 0x0000C000; } int main (void) { PINSEL4 = 0x00500000; FIO2DIR = 0x000000FF; FIO2PIN = 0x00000000; init_eint(); // Enable EINT0/1 while (1){ ; } }
Could anyone please suggest a method to prevent this.
prevent what? this sounds like normal program execution to be. I don't think you can affect the status of raw interrupts in the VIC. you might want to consider adding some logic to your program that is based on time difference or something similar.
I mean is there a way from preventing the execution of ISR2 directly after the completion of execution of ISR1. FYI, interrupts are asynchronous.
The question has now been answered:
tech.groups.yahoo.com/.../47044
thanks for reminding me that interrupts are asynchronous. regarding your issue - are you using edge or level sensitive interrupts? I don't think you can pull off that trick of writing a "1" into EXTINT if it is level sensitive.