KBSCR_MODEK triggering keyboard interrupt! (HC908QY4)

Aug 09, 2005 1 Replies

Hi,



I'm writing my first ever MCU program using CodeWarrior and MC68HC908QY4 processor. When I go to set the KBSCR_MODEK = 1 so that my keyboard interrupt is low-level and falling edge sensitive, it falsly triggers a keyboard interrupt. I've tried everything they said in the datasheets but still no luck. Anyone know what to do?



Below is my code:



#include /* for EnableInterrupts macro */ #include /* include peripheral declarations */



#define EVER (;;)



void main(void) { EnableInterrupts; /* enable interrupts. Same as CLI command */ /* include your code here */



//setting CONFIG1 and CONFIG2 CONFIG1 = 0x2B; //00101011 CONFIG2 = 0x01; //00000001



//setting ADSCR ADSCR = 0x23; //00100011 Continous ADC on AD3



//enabling keyboard inputs KBSCR_IMASKK = 1; KBIER = 0x13; //00010011 KBSCR_MODEK = 1; KBSCR_ACKK = 1; KBSCR_IMASKK = 0;


}

interrupt 15 void KBI_ISR(void){



KBSCR_ACKK = 1; //acknowledging interrupt asm STOP; }


the way i know it is triggering the interrupt is when i run the debugger in codewarrior, the program stops at 247 CPU cycles and when i then halt the debugger, it goes to "asm STOP;" line. now, if i remove the "KBSCR_MODEK = 1;" line, the debugger runs to the end of the main function and stops like it is supposed to.



any help would be appreciated.



thanks, Aria



wow, weird. I commented out the "EnableInterrupts;" command on the first line of the main() function and the problem went away. Anyone know why? Codewarrior put that EnableInterrupts by itself, not me. Should I put it back in or can i leave it out?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required