Manual of Board ET-TOUCH PAD 4x4 V2
www.etteam.com
-
17
-
1
3
2
4
5
6
7
8
9
0
SHIFT
HELP
ENTER
CLEAR
Figure 5.9 shows how to connect circuit to read Key Code as ASCII of Board MCU and ET-TOUCH PAD 4x4 V2 (TTL).
Ex2_Read_ASCII_ShifKey
: This example illustrates how to read Key Code as ASCII. It presses Key F together with another Key and it uses
Interrupt to setup interval of receiving data. In the part of Display, it shows ASCII Code in the format of HEX through
Port of MCU that is connected with LED.
When user starts touching any Key, program skips to receive incoming data and store until all 3 Byte Data is
completed. Next, it checks if the last Byte is 0x0D; if yes, it means that it received all 3 Byte Data completely and it is
correct. Next, it returns to check if the first Byte that received is ASCII ‘P‛; if yes, it means that it touched Key. It checks
the received Data in the second Byte that is ASCII Key Code of the touching Key; it checks if the value is equivalent to
ASCII CODE ‘F’; if no, it means that it presses single Key, Program sends the second ASCII CODE Byte to display in
the format of Hex through Port of the connective LCD. For example, if touched Key 0, the ASCII Code in the format of
Hex is 0x30 (NOTE: For the example of Arduino, it can display the result of touching Key in the range of Key0-Key9
only). If the Key that is touched is Key F, Program loops and waits for receiving the second Key that is pressed together
with Key F. When touched the second Key, Program checks if the last Byte Data is equal to 0x0D; if yes, it returns to
check if the first Byte is ASCII ‘F’; and if yes, it means that it pressed the second Key together with Key F. So, Program
sends the second ASCII CODE Byte of the touched Key to display in the format of Hex through Port of the connective
LCD. For example, if touched KeyF+Key9, the ASCII Code in the format of Hex is 0x39 (NOTE: Other Keys that can be
pressed together with Key F in this Program must be in the range of Key0-Key9 only). Finally, after touched completely,
Program returns to read the Data again to check Data of releasing Key. If the first Byte Data is ASCII ‘R’, it means that it
has already released Key; so, Program returns and waits for reading Data of the next touch. The circuit connection that is
used to test this program is the same as the example 1 above.
Board
ET-TOUCH PAD 4x4 V2
Board MCU
Vcc
Rx
Tx
Gnd
+VDD
RX(TTL)
TX(TTL)
GND
+5V
T
T
L
2
3
2
(
7
)
Interface 232TTL
A
T
m
e
g
a
1
6
8
(A
rd
u
in
o
)
D1
D0
TTL232
RS232
J
P
-2
3
2
(4
)
A
T
m
e
g
a
1
2
8
PE0
PE1
P
IC
1
8
F
8
7
2
2
RC6
RC7
P3.0
P3.1
8
9
C
5
1
R
E
2
Baud Rate=9600