AnsweredAssumed Answered

MC9SGB60: writing to KBISC during keyboard interrupt ignored

Question asked by Peter Vittali on Oct 21, 2016

This is the code:


#define Vkeyboard 22
#define ON 0
#define OFF 1
#define LED1 PTFD_PTFD0
#define LED2 PTFD_PTFD1


interrupt Vkeyboard void intCLK() {
  LED1 = !LED1;
  KBI1SC &=  0x0f;  // (1) commenting out this will render ineffective statement (2)
  KBI1SC_KBACK = 1;   // clear interrupt
  KBI1SC_KBEDG4 = 1;  //  (2) wait for rising edge


void main(void) {


  /* LEDs are output*/
  PTFDD = 0x03;
  LED1 = OFF;
  LED2 = OFF;
  KBI1SC = 0x02; // request HW , edge only
  KBI1SC_KBEDG4 = 0;  // first wait for falling edge
  KBI1PE_KBIPE4 = 1;


  for(;;) {
  /* please make sure that you never leave main */


During the keyboard interrupt handler, I want to change the edge behavior ( from falling to rising ). This works as long as I

outcomment line (1) where I write to KBI1SC register. If do this write, the command KBI1SC_KBEDG4 is ignored, that is the edge dectection remains falling edge. Worse, after a couple of changes , the keyboard interrupt stops working all toegether.


I use the Axion demoboard for the GB60 with an external debounced push button.


What's wrong with that write to KBI1SC inside the interrupt handler ?


Thanks for your support