English
Language : 

W681308DG Datasheet, PDF (33/64 Pages) Nuvotem Talema – W681308 USB Audio Controller from Nuvoton integrates fast 8051 Microcontroller Unit (MCU)
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
soft ware:
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 KY[4:0] status, MCU
can know which bit equal 0, allowing it to determine which row is pressed.
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
S6
S11
S16
S21
KX[0]
S2
S7
S12
S17
S22
KX[1]
S3
S4
S5
S8
S9
S10
S13
S14
S15
S18
S19
S20
S23
S24
S25
KX[2]
KX[3]
KX[4]
Figure 4 Keypad Scanning Application Circuit
KY[0]
KY[1]
KY[2]
KY[3]
KY[4]
33
Rev1.2