KBSCR_MODEK triggering keyboard interrupt! (HC908QY4)

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

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 <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908QY4.h> /* 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
  KBIER = 0x13; //00010011


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.


Re: KBSCR_MODEK triggering keyboard interrupt! (HC908QY4)
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?

Site Timeline