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

LPC932 Using Keypad Interrupt to Wake up from P.D.M

Hi, I am using the Keypad interrupt on the LPC932 to wake it from Power Down Mode. It works fine when the micro is in normal mode...it executes the keypad ISR. However, when it enters power down mode it does not wake up or at least it does not execute the ISR. Below is the code I am using... I enter PDM right before [while (D_reset != 1);] where D_reset = P0^1. Right now I have (PCON |=0x02;) commented out because it works fine like that (normal mode). Where should PCON |=0x02; be placed in order for the micro to go into PWM and wake up when D_reset goes high.
=============================================
sbit D_reset = P0^1;

void main(void) {

init();
brkrst_init();
P2 = 0x00; // turn off ports
P1 = 0x00;
P0 = 0x00;
P3 = 0x00;
keypad_init();
while(1)
{
PCONA = 0xEF; // turn off most peripherals
//PCON |= 0x02;
while (D_reset != 1);

if ((KBCON & 0x03) == 0x03) {
EKBI = 1;
EA = 1;
}
if ((PCON & 0x04) == 0x04) {
PCON |= 0x01; }
}
while(1);

}

void keypad_init(void)
{
KBPATN = 0x02; // P0.1 must be pulled high
KBCON = 0x02; // Port 0 must match KBPATN to generate interrupt
KBMASK = 0x02; // mask out all pins except P0.1
}

void keypad_isr(void) interrupt 7 using 1 {

P2 = 0x55;
_nop_(); _nop_();
_nop_(); _nop_();
_nop_(); _nop_();
_nop_(); _nop_();
_nop_(); _nop_();
PCON |= 0x04;
KBCON &= 0xFE; // clear KBIF interrupt flag
}

0