Ernest Snaith

Keyboard interrupt

Discussion created by Ernest Snaith on Apr 30, 2007
Latest reply on Apr 30, 2007 by David Payne
I have been tring to get the keyboard interrupt to work on MC9S08QG8. I have simplifed the code to the following to try and find the problem.
 
Code:
void main(void) {   SOPT1_COPE = 0;  //diable COP   // KBI Set Up foe SW1   KBIPE_KBIPE1 =1;   /* Enable Keyboard Pin */                                     KBISC_KBIE = 1;    /* Enable Keyboard Interrupts */   KBISC_KBACK = 1;   /* Clear Pending Keyboard Interrupts */   PTAPE_PTAPE1 = 1;   /* Enable Pullup for Keyboard pin */   KBISC_KBIMOD = 1;   PTBDD_PTBDD1 = 1;  //A1   EnableInterrupts;    for(;;)                   // Loop Forever  {  }}//*******************************************// KBI ISR         // interuptinterrupt 18 void   KBI_ISR(void) {     PTBD_PTBD1 = ~PTAD_PTAD1;    /* toggle Port */  KBISC_KBACK = 1;
}

 

The waveform from a light gate is input to the keyboard interupt pin and i expect the output pin to toggle on change. However, altough it does most of the time many interupts are missed. Below are the input and output waveforms. I have zoomed in on input waveform and it appears to be clean. Any suggestions greatly appreciated.

Many Thanks

 


 

Outcomes