Stop mode problems with qg8

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Stop mode problems with qg8

2,618 Views
airswit
Contributor III
Hi everyone,

I am trying to get this thing to enter stop3 mode, and exit due to kbi interrupt. I would also like BDM support, since I am not complete with this project yet. Something is going wrong here, because my processor won't come out of stop mode to service the KBI interrupt, and the BDM is having a tough time communicating with the processor. I have attached the code below...can someone help me figure out what I am doing wrong?


void main(void)
{
EnableInterrupts; /* enable interrupts */

SOPT1_COPE = 0; //turn of the effin watchdog!
ICSC2_BDIV = 3; //divide clock freq by 8 = bus freq
PSU = PWROFF; //turn off led1
LED2 = OFF; //turn off led2
onOff = MTIMCNT;
onOff = OFF;

PTBDD_PTBDD7 = 1; /* Set PTB7 as an output */
PTBDD_PTBDD6 = 1;

/** mtim_setup */
MTIMCLK = 0x18;

/** KBI Set Up foe SW1 */
KBIPE_KBIPE2 =1; /* Enable Keyboard Pin */
KBIPE_KBIPE3 = 1;
PTAPE_PTAPE2 = 1; /* Enable Pullup for Keyboard pin */
PTAPE_PTAPE3 = 1;
KBIES_KBEDG2 = 1;

KBISC_KBACK = 1; /* Clear Pending Keyboard Interrupts */
KBISC_KBIE = 1; /* Enable Keyboard Interrupts */
SOPT1_STOPE = 1;

asm STOP;

for(;:smileywink:
;
} /* please make sure that you never leave this function */



/** KBI ISR */
interrupt 18 void KBI_ISR(void)
{
// uint i;
wait20ms();

if(PTAD_PTAD3 != 0 && PTAD_PTAD2 != 1) //make sure the pin is not just being released from the last
{ //keypress, or was released too fast
KBISC_KBACK = 1;
return;
}
if(onOff == OFF && PTAD_PTAD3 == 0)
{
PSU = PWRON;
onOff = ON;
}
else
{
if(PTAD_PTAD3 == 0)
{
LED2 = ON;
longWait();
}
LED2 = OFF;
PSU = PWROFF; //turn '0ff' our power supply
onOff = OFF;
}
KBISC_KBACK = 1; /* Clear Pending Keyboard Interrupts */

}
Labels (1)
0 Kudos
Reply
1 Reply

761 Views
airswit
Contributor III
nobody has any thoughts, huh?
0 Kudos
Reply