Hc908QT1 MODEK=1

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

Hc908QT1 MODEK=1

360 Views
lucostiguy
Contributor I

Hi when i set-up the keyboard module in level and edge the KeyF is set and cannot be clear. Even if i write 1 to ACKK. i'm using kbi0 and kbi1 as input switch pulled up. and pta4 and pta5 as output to leds.

 

mov #$03,kbscr

mov #$03,kbier      -> keyf set to 1 ?

mov #$07,kbscr      -> doesn't cleat keyf

input pin0 and pin1 are set to logic 1

?

0 Kudos
1 Reply

288 Views
mfugere
Contributor III

Are you certain of the part number for the device you are working with?  I don't know that version -

However, for MC9S08AC60 (what I am using at the moment)  when keyboard interrupt is generated, in my interrupt service routine I do:

KBISC = KBISC_KBACK;   //  0x04   Acknowledge kb interrupt, clear KBIMOD so it is edge only, clear KBIE so no new interrupt is generated for now

.... do other things..

KBISC = KBISC_KBIE | KBISC_KBIMOD; // RE enable interrupt generation for active low and falling edge

What is important to note, if you are using falling edge AND low levels to trigger interrupt like I am doing, is that the KBF flag will continuously be asserted if the input pin is still remaining in the low level after the falling edge occurs.  So, when I write with the KBISC_KBACK = 1, I make KBIMOD = 0 so that the KBF bit should clear (or at least another interrupt will not be generated because the KB Controller will be in edge only, not edge and level move).

When I am ready to leave the interupt routine I write the KBISC_KBIE | KBISC_KBIMOD bits = 1 to restore keyboard interupts to edge and level function.

So, depending on KBEDG(bits 7- 4) bits and KBIMOD (bit 0) if any of the enabled inputs in KBIPE register are remaining in the activated level/state, the KBIF flag will continuously be set=1.

0 Kudos