background image

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

Summary of Contents for ET-Touch PAD 4x4 V2

Page 1: ...CONNECTOR 8 PIN Pin T R and SHIF shows status of pressing or releasing Key 2 ASCII Code Send value though Connector RS232 TTL and Line Driver setup fixed Baud Rate at 9600 ASCII P or R preceded Key Code to notify status of pressing or releasing Key If Key Touch Pad is made from translucent plastic it is 1 3 millimeters thick depending on humidity in the air If it is made from other materials the t...

Page 2: ...wn in the figure above While assembling both parts together please notice direction of the arrowhead or cut angle PCB of MCU Control Board it must be the same direction as shown at the back of Touch PAD Board and finally user can assembly both parts together Figure 2 2 shows the front of Touch PAD Board Figure 2 3 shows the front and the back of MCU Controller Board 7 TTL232 6 JP LED 5 JP BZ 3 RS2...

Page 3: ...SCII Moreover it can receive user s Command to control operating system of Buzzer and LED STATUS while no KEY is pressed for more information please read COMMAND for CONTROL LED BUZZER Figure 2 4 shows Connector RS232 Line Driver for sending Command and reading Key Code as ASCII Code Details of each PIN VDD GND Interface Power Supply for Board that is either VDC 3 3V for MCU 3 3V or 5V for MCU 5V ...

Page 4: ...oss line between RX TX while connecting The operating system of this Connector is the same as Connector RS232 No 3 but the signal level only is different because it is lower so it can be connected with Pin MCU directly Figure 2 6 shows Connector TTL232 to send Command and read Key Code as ASCII CODE Details of each PIN VDD GND Interface Power Supply for Board that is either VDC 3 3V for MCU 3 3V o...

Page 5: ...ther ASCII Code or Binary Code because it has to choose only one Connector type correctly If reading Key Code as ASCII Code it has to choose Connector RS232 3 or TTL232 7 or if reading Key Code as Binary BCD8421 it has to choose Connector O P BCD Key Code 10 In the part of Power Supply VDD GND for Board user can choose only one Connector to interface signal it is either Connector RS232 3 or TTL 7 ...

Page 6: ...e is set as follows PIN SHIF 1 PIN T R 1 PIN8 0 PIN4 0 PIN2 0 PIN1 0 Figure 3 1 shows the Initial Status Default at Pins of Connector 8 Pin KEY FOR Binary MODE FOR ASCII Mode RS232 TTL Line Drive BCD 8421 KEY CODE ASCII KEY CODE 8 4 2 1 HEX ASCII HEX 1 0 0 0 1 0x01 1 0x31 2 0 0 1 0 0x02 2 0x32 3 0 0 1 1 0x03 3 0x33 4 0 1 0 0 0x04 4 0x34 5 0 1 0 1 0x05 5 0x35 6 0 1 1 0 0x06 6 0x36 7 0 1 1 1 0x07 7 ...

Page 7: ...ssing the 2nd Key that is the remaining Key Key F is still pressed PIN T R is still Logic 0 but PIN SHIF changes the status from Logic 1 to 0 and the status still remains throughout while pressing Key F another Key 4 PIN BCD8 4 2 1 sends out Key Code of the 2nd Key to user Figure 3 3 shows example of status at PINs of Connector 8PIN when pressing Key F together with another Key Key F Key3 Status o...

Page 8: ...ng both Keys that are pressed together the status of both Keys is also changed to Logic 1 3 2 How to read Key Code as ASCII When reading Key Code as ASCII user can read the value from Connector RS232 or TTL232 it is Serial Port Interface and the Baud Rate is fixed as 9600 bit s When choosing Connector type it depends on Port 232 of Board that is connected with Touch PAD it is either TTL or IC Driv...

Page 9: ...ET TOUCH PAD sends out is ASCII F 0x46 the second Byte is ASCII Key Code of the pressed Key and finally the last Byte is 0x0D to end Table shows the format of sending Data when pressing 2 Keys together NOTE When pressing 2 Keys together there are 2 sets of Data that are sent out The first set is Byte Data of Key F that is ASCII P it is sent out to notify that it is status of pressing Key and its f...

Page 10: ... both Keys that are pressed together 4 How to send Command Control Buzzer LED Status Key In the part of Port 232 it can send ASCII Key Code to user moreover it can support ASCII Command from user to control the operation of Buzzer and LED Status Key on Board The main target is to use Buzzer and LED Status Key as Alarm Function when it does not press any Key but when it presses any Key Key returns ...

Page 11: ...Byte1 Byte2 3 Byte4 Byte5 Byte6 BP 0 9 Enter 0x0D Respond Command จำก Board OK Data 0 9 Length of Beep sound When setting 1 Beep sound is the shortest 0 Beep sound is the longest Ex Send Command to produce Beep sound and set the length of Beep sound as level 5 Main char enter 0x0D printf BP 5 enter Sent Command Beep 3 COMMAND LE LED ENABLE This Command ON LED Status Key is to turn on all LED at on...

Page 12: ...olum1 4 ดวง 2 OFF LED Colum2 4 ดวง 3 OFF LED Colum3 4 ดวง 4 OFF LED Colum4 4 ดวง 5 OFF LED Row1 4 ดวง 6 OFF LED Row2 4 ดวง 7 OFF LED Row3 4 ดวง 8 OFF LED Row4 4 ดวง Ex Send Command to turn off all LED at once Main char enter 0x0D printf LD 0 enter Sent Command OFF LED ALL NOTE When sending Commands consecutively it always checks status of Respond Command between Commands that are sent out or it ma...

Page 13: ...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...

Page 14: ...ey T R 1 If the pressed Key is Key F the program loops to read Key Code of another Key that is pressed together with KeyF It checks Signal SHIF if it is 0 it means that another Key is pressed together with Key F Program reads Key Code of the second Key from Connector BCD8421 and it sends out the Key Code through Port to display the data on the connective LCD except Arduino it does not display any ...

Page 15: ... Display and MCU please look in Source Code The operation in the part of reading Key Code is the same as the example 2 above but it is different in the part of Program that responds to pressing Key only In the part of LCD Display it shows the message as shown in the figure 5 5 if it does not press any Key Figure 5 5 When pressing 1 Key that is not KeyF such as Key 8 LCD Display shows the message a...

Page 16: ...ving 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 ...

Page 17: ...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 By...

Page 18: ...am com 18 1 3 2 4 5 6 7 8 9 0 SHIFT HELP ENTER CLEAR PCB LAYOUT PCB LAY OUT 1 2 3 4 A 5 6 B 7 8 9 C 0 F D E 4mm 4mm 3 3mm 2mm 7 7mm 13 45mm 16 6mm 16 51mm 88 9mm 76 2mm 10mm 13 2mm 19 65mm 16 6mm 16 51mm PCB Dielectric 2mm 38 1mm 20mm Under Side ...

Page 19: ...Manual of Board ET TOUCH PAD 4x4 V2 www etteam com 19 1 3 2 4 5 6 7 8 9 0 SHIFT HELP ENTER CLEAR ET TOUCH PAD 4x4 V2 Sheet1 ...

Page 20: ...Manual of Board ET TOUCH PAD 4x4 V2 www etteam com 20 1 3 2 4 5 6 7 8 9 0 SHIFT HELP ENTER CLEAR ET TOUCH PAD 4x4 V2 Sheet2 ...

Page 21: ...Manual of Board ET TOUCH PAD 4x4 V2 www etteam com 21 1 3 2 4 5 6 7 8 9 0 SHIFT HELP ENTER CLEAR ET TOUCH PAD 4x4 V2 Sheet3 ...

Reviews: