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.
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
Hello,
Thanks much for your support.
//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.
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
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.