AnsweredAssumed Answered

Question on RS08 keyboard interrupt

Question asked by Sven Kopacz on May 30, 2009
Latest reply on May 30, 2009 by Sven Kopacz



I checked the MC9RS08KA2.pdf but am still not sure about two things:


1. When I configure multiple pins as a keyboard interrupt source, how am I supposed to find out which pin did actually cause the interrupt?

From how I got it, I need to poll SIP1_KBI (same for all pins) to find out about an interrupt at all.

What is the recommended best practice after that, just read the value of the port bits, like this:


if(PTAD_PTAD0) // Key 0 pressed


if(PTAD_PTAD1) // Key 1 pressed


or is there  a different method?


2. How do I reset the interrupt flag to allow for successive interrupts?


Chapter 5.8.6 says (about the SIP1_KBI bit):

"Clearing the KBF flag of the KBISC register clears this bit."


Chapter 7.3.1 however states:

"Writes have no effect on KBF." So I assume "KBISC_KBF = 0;" won't work.


Then I find:

"Writing a 1 to KBACK is part of the flag-clearing mechanism."


This sounds like it would take several steps to really clear the flag, however I can't seem to find a more detailed description of the mentioned "flag-clearing mechanism."


So is "KBISC_KBACK = 1;" all there is to do? According to the block diagram this seems fine, but the above quote is somewhat confusing to me.