KBI question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KBI question

1,354 Views
Hsin
Contributor I

Hi,

I am trying to run the basic KBI function on processor expert. I use DEMO9S08LL16 demo board. The goal is to make the variable "state" increase 1 when KBI activated every time. I use PTA pin 7 for KBI. However, I got cpu_interrupt when I push the button (KBI activate) in the first time. I could not figure out what happen. Please advice. 

 

Thanks much.

 

I attached my code in the attachement.

Labels (1)
0 Kudos
5 Replies

471 Views
ProcessorExpert
Senior Contributor III

 

Hello,

 

it is not Processor Expert issue, it is rather application issue. Please check attached example of using Init_KBI component to initializace KBI registers including proper allocation of interrupt vector. I thing the example can be easily modified to provide functionality you need.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos

471 Views
Hsin
Contributor I

Hello,

Thanks much for your support.

 

 

0 Kudos

471 Views
Lundin
Senior Contributor IV

  //clear KBF
  KBISC_KBACK = 1; // wrong bit??

Well... you could try to do what your comment says and clear KBF bit (flag) rather than some acknowledge flag.

 

KBISC_KBF = 1;

 

If you have an actual mechanical button you must also add a timer for debouncing the signal.

0 Kudos

471 Views
bigmac
Specialist III

Hello Lundin,

 

For the device in question, and other HCS08 devices, the KBACK bit is a write only bit used for clearing the the KBF flag.  According to the reference manual, writes to KBF have no effect.

 

I agree with the need to debounce a mechanical switch.

 

Regards,

Mac

 

0 Kudos

471 Views
Lundin
Senior Contributor IV

Oops I should probably check the manual before posting. In that case the only issue is that the isr wasn't included in the vector table, as already mentioned.

0 Kudos