GMS81C5108
18. KEY SCAN
The key-scan block consists of key scan mode register
(KSMR) and R1 pull-up register (R1PU). When the key
scan interrupt is used, key scan mode register KSMR (ad-
dress 0F0H) should be set properly as shown in Figure 18-
1. The pins which is to be used as key scan input should be
set by KSMR and the strobe output pins should be set as
open drain. The strobe output pins could be selected from
among R0[7:0], R1[7:0], R2[3:0] and R3[3:0].
If the “L” signal is input to any one or more of key scan in-
put pins, the KSIF request flag is set to “1”. This generates
an interrupt request. It also can be used in the way of re-
lease from STOP mode.
V
DD
R1PU[7:0]
KSMR
R10/KS0
R11/KS1
R12/KS2
R13/KS3
R14/KS4
R15/KS5
R16/KS6
R17/KS7
Key Scan
Interrupt
KSIF
KSMR (Key Scan Mode Register)
R/W
6
R/W
5
R/W
4
R/W
3
R/W
2
R/W
1
R/W
0
R/W
7
Bit :
ADDRESS : 0F0
RESET VALUE : 00
H
KS7
KS6
KS5
KS4
KS3
KS2
KS1
KS0
H
0 : Port Function (I/O) Selection
1 : Key Scan Input Selection
Figure 18-1 Key Scan Interrupt Block Diagram
Usage of Key Scan
delay time. Because the rising time of the output strobe
port from “L” to “H” is so long. The Figure 18-2 explain
this reason.
When key board scanning, it is recommended that set the
output strobe to “L” first and then read R1 port after 60us
;Program Example,
LDM
CALL
LDA
R3,#0000_1110b ;R3<0> Port set to low
If the rising time is so long, the key scanning could be
detected double key with R3<0> and R3<1>.
Delay_60us
R1
;60us time delay routine
;read R1 port
60µs
R3<0>
R3<1>
60µs
R1 Port Read Timing
Figure 18-2 Key Scan Timing
70
JUNE 2001 Ver 1.0