W681308
XXXX PRODUCT DESCRIPTION
11.
Interface Logic
The W681308 Interface logic consists of:
Keypad Scanner Interface
Input/Output GPIO Ports
LCD/LCM interface
UART interface
JTAG Interface
PCM Interface
SPI for Serial Data Flash
W2S Interface
Keypad scanner, GPIO, LCD/LCM and UART interfaces are covered in this section.
11.1
Software Keypad Scanner
The keypads consist of a number of buttons, connected in a row/column arrangement as shown in
Figure 4 The default pin KX[4:0] is pull-L and pin KY[4:0] is pull-H, User can follow below steps to scan the keypad by
software:
1. Program KX[4:0] pin to output direction and output data 0. Program KY[4:0] pins to input direction.
2. While key is pressed, MCU will be informed by GPIO interrupt then to check KX[4:0] and KY[4:0] status.
3. KX[4:0] keep output data 0, then to read KY[4:0] status by register 0x1451[4:0], By reading
can know which bit equal 0, allowing it to determine which row is pressed.
KY[4:0] status, MCU
4. Change pin KY[4:0] from input direction to output direction and output data 1. Change pin KX[4:0] from output
direction to input direction then to read KX[4:0] status by register 0x1450[4:0]. By reading KX[4:0] status, MCU can
know which bit equal 1, allowing it to determine which column is pressed.
5. MCU knows which row and column are pressed, so it can determine which key is pressed.
S1
S2
S3
S4
S5
KY[0]
KY[1]
KY[2]
KY[3]
KY[4]
S6
S7
S8
S9
S10
S15
S20
S25
S11
S16
S21
S12
S17
S22
S13
S18
S23
S14
S19
S24
KX[0]
KX[1]
KX[2]
KX[3]
KX[4]
Figure 4 Keypad Scanning Application Circuit
33
Rev1.2