![Sino Wealth SH69K55A Скачать руководство пользователя страница 39](http://html1.mh-extra.com/html/sino-wealth/sh69k55a/sh69k55a_manual_1283061039.webp)
SH69P55A/K55A
39
10. Key Scan
There is a key scanner built in the SH69P55A/69K55A, which can automatic detect the key-press. It includes four outputs
(KEY_O1 - 4, shared with COM1 - COM4), five inputs (KEY_I5 - 1, shared with SEG1 - SEG5), and it can detect 20 individual
keys. The key scan function must be shared with LCD or LED function, so the key scan must work in proper LCD or LED mode.
Since the LCD/LED drive waveform integrates the key scan waveform, the LCD/LED drive waveform is enlarged by a duty
period compared with the traditional waveform. For instance, 1/4 duty would be enlarged to1/5 duty. The additional duty period is
used to scan keys, and it would be inserted into the end of the frame automatically. The LCD waveform scans keys one time
every one frame. The key scanner only works a duty period for each frame and it does not work for the rest duty periods of the
frame. It scans keys during the last duty period of the first half frame, but it does not work during the last duty period of the last
half frame. For instance in 1/4 duty mode the key scanner only works during the last duty period of the first half frame, but it does
not work during the rest 9 duty periods of the frame. The LED waveform scans keys one time every two frame. The key scanner
only works a duty period for every two frames and it does not work for the rest duty periods of the two frames. It scans keys
during the last duty period of one frame, but it does not work during the last duty period of the next frame. For instance in 1/4
duty mode the key scanner only works a duty period for every two frames and it does not work during the rest 9 duty periods of
the two frames.
Once the end of the key scan reaches, the key interrupt request flag would be set (KEYIF) whether a key is pressed or not. In
LCD mode the key interrupt request flag is set every one frame. In LED mode the key interrupt request flag is set every 2
frames.
Key Scan Control Register: $28
Address
Bit 3
Bit 2
Bit 1
Bit 0
R/W
Remarks
$28
KEYNUM1
KEYNUM0
KEYEND
KEYEN
R/W
R
Bit0: key scan enable register
Bit1: key scan end/processing register
Bit3 - 2: key scan result register
X
X
X
0
R/W Disable key scan
X
X
X
1
R/W Enable key scan
X
X
0
1
R
Key scan end
X
X
1
1
R
Key scan processing
X 0 X 1
R
No
key-press
X 1 X 1
R
Key-press
occur
0
X
X
1
R
One key-press occur, at the same time
1
X
X
1
R
More than one key-press occur, at the same time
Key Scan Data Register1: $2C
Address
Bit 3
Bit 2
Bit 1
Bit 0
R/W
Remarks
$2C
KEYC3
KEYC2
KEYC1
KEYC0
R
Bit3 - 0: the result of key scan on KEY_O4 - 1
0
0
0
1
R
Key-press occur on KEY_O1
0
0
1
0
R
Key-press occur on KEY_O2
0
1
0
0
R
Key-press occur on KEY_O3
1
0
0
0
R
Key-press occur on KEY_O4
Key Scan Data Register2: $2D
Address
Bit 3
Bit 2
Bit 1
Bit 0
R/W
Remarks
$2D
KEYL3
KEYL2
KEYL1
KEYL0
R
Bit3 - 0: the result of key scan on KEY_I5 - 1
0
0
0
0
R
Key-press occur on KEY_I1
0
0
0
1
R
Key-press occur on KEY_I2
0
0
1
0
R
Key-press occur on KEY_I3
0
1
0
0
R
Key-press occur on KEY_I4
1
0
0
0
R
Key-press occur on KEY_I5