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

Issue with LPC2378 IRQ interrupts

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){
           ;
   }
}

Parents
  • 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.

Reply
  • 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.

Children