pcsandhya82
Member level 3
Hi,
I am trying to interface a PIR sensor to LPC2129. below is how I have configured the interrupt:
//
void ext(void) __irq //P0.3 as external interrupt 1
{
CMDWRT(0x01);
LCD_DATA_WR("OBJECT DETECTED");
motor_stop();
EXTINT=0X02; //clear interrupt flag
VICVectAddr = 0x00000000;
VICIntEnable |= 0x00008000;
}
// in main program
PINSEL0|=0X000000C0; // PINSEL0<7:0> =11
EXTPOLAR=0x00; // falling edge sensitive
EXTMODE=0x02; //edge sensitive
VICIntEnable = 0x00008000;
VICVectCntl10 = 0x0000002F;
VICVectAddr10=(unsigned)ext;
This is working fine and executing ISR when falling edge occurs on P0.3
But since the sensor output is high, I would like it to execute ISR on rising edge. So I changed the setting of EXTPOLAR to =0x02; // rising edge sensitive
But its not working. I cant find out any configurations that i have missed out. Read the errata on VPBDIV and EINT1, and tried the below code:
unsigned char vpb;
vpb = VPBDIV ;
VPBDIV = 0x00;
EXTPOLAR=0x02; // falling edge sensitive
EXTMODE=0x02;
VPBDIV = vpb;
This also doesnt work.
Can someone please help?
Thanks.
I am trying to interface a PIR sensor to LPC2129. below is how I have configured the interrupt:
//
void ext(void) __irq //P0.3 as external interrupt 1
{
CMDWRT(0x01);
LCD_DATA_WR("OBJECT DETECTED");
motor_stop();
EXTINT=0X02; //clear interrupt flag
VICVectAddr = 0x00000000;
VICIntEnable |= 0x00008000;
}
// in main program
PINSEL0|=0X000000C0; // PINSEL0<7:0> =11
EXTPOLAR=0x00; // falling edge sensitive
EXTMODE=0x02; //edge sensitive
VICIntEnable = 0x00008000;
VICVectCntl10 = 0x0000002F;
VICVectAddr10=(unsigned)ext;
This is working fine and executing ISR when falling edge occurs on P0.3
But since the sensor output is high, I would like it to execute ISR on rising edge. So I changed the setting of EXTPOLAR to =0x02; // rising edge sensitive
But its not working. I cant find out any configurations that i have missed out. Read the errata on VPBDIV and EINT1, and tried the below code:
unsigned char vpb;
vpb = VPBDIV ;
VPBDIV = 0x00;
EXTPOLAR=0x02; // falling edge sensitive
EXTMODE=0x02;
VPBDIV = vpb;
This also doesnt work.
Can someone please help?
Thanks.