Faruk Chaudhry

Determining which switch causes the Keboard Interrupt for the HCS08

Discussion created by Faruk Chaudhry on Jun 20, 2006
Latest reply on Jul 4, 2006 by bigmac
Hi,
 
How to determine the pressed key for the HCS08 KBI module under interrupt driven mode?
 
Here is my code:
 
__interrupt void isrVkeyboard(void)
{
 
  unsigned char delay = 0xFF;
  unsigned char pressed_switch;
 
  pressed_switch = PTAD;
  while(delay--);                         // debounce switch
  KBISC_KBACK = 1;               // clear KBACK flag
  timer_mode = ~timer_mode; // switch timer function mode
 
}
I am only using SW2 on the DEMO9S08QG8 board, so the variable pressed_switch is not used yet. The KBI is set at falling edge only.
 
Thanks
 

Outcomes