Manual of Board ET-TOUCH PAD 4x4 V2
www.etteam.com
-
13
-
1
3
2
4
5
6
7
8
9
0
SHIFT
HELP
ENTER
CLEAR
5. Example Programs and How to connect Circuit to read Key Code by MCU
This example illustrates how to read Key Code in the format of Binary BCD8421 and ASCII Code, it supports 4 series of MCU. If
it is AVR EASY MEGA168, it uses Arduino Compiler; if it is AVR MEGA 61/128, it uses C-WIN AVR; if it is MCS51-AT89C51RE2, it
uses C-Keil Compiler; and, if it is PIC8722, it uses CCS Compiler. There are 2 examples for each MCU; firstly, it reads Key Code in the
format of Binary BCD8421; and secondly, it reads Key Code in the format of ASCII Code. It illustrates the operational detail of program as
follows (Source Code is provided in CD).
Example of reading Key Code as Binary BCD8421
Ex
1
_Read_BCD_
1
Key
: This example illustrates how to read Key Code as BCD8421. It uses single Key, so user can use Key F (SHIFT) as
normal as other keys. For Pin SHIF#, it is not connected to MCU.
When user stars touching any Key, MCU will check Signal T#/R to check status of touching Key. If touched
any Key (T#/R=0), it reads Key Code from Connector BCD8421 and sends out the Key Code through Port to display the
result on the connective LED (except Arduino, it does not display any data in this part); and finally, it types the Key Code
to display data at Hyper Terminal on PC. For example, if touched Key 5, LED shows the value as 0x05 and Hyper
Terminal also shows message ‚Key_Code BCD = 0x05‛. Next, MCU will check Signal T#/R again to check the status of
releasing Key (T#/R=1). When released Key completely, the program returns to check Signal T#/R to check status of
touching the next Key. This is overall operation of the first example of each MCU. The example circuit that supports the
first example is illustrated in the figure below;
Figure 5.1 shows how to connect circuit to read Key Code as BCD of Board ET-TOUCH PAD 4x4 V2 and ET-BASE AVR EASY
MEGA168.
Figure 5.2 shows how to connect circuit to read Key Code as BCD of Board ET-TOUCH PAD 4x4 V2 and ET-BASE AVR
ATmega128 R3.
Board
ET-TOUCH PAD 4x4 V2
GND
SHIF#
T#/R
+VDD
8
4
2
1
Board
ET-BASE AVR EASY
MEGA168
D11
D10
D9
5V
D8
GND
D13
D12
V
c
c
(D
1
)R
x
(D
0
)T
x
G
n
d
Display to PC
Hypertermina
RS232
1
0
.
O
/P
B
C
D
K
e
y
C
o
d
e
* PIN SHIF# Connect For Ex.2,Ex3
Arduino
BR=9600
1
Clear
SHIFT
Enter
Board
ET-BASE AVR-
ATmega128 r3
PA3
PA2
PA1
5V
PA0
GND
PA5
PA4
PC0
PC7
560
LED
+5V
Display LED
V
c
c
(P
E
0
)R
x
0
(P
E
1
)T
x
0
G
n
d
Display to PC
Hypertermina
RS232
* PIN SHIF# Connect For Ex.2,Ex3
Board
ET-TOUCH PAD 4x4 V2
GND
SHIF#
T#/R
+VDD
8
4
2
1
1
0
.
O
/P
B
C
D
K
e
y
C
o
d
e
1
Clear
SHIFT
Enter
BR=9600