Design of RS232 matrix keyboard interface

Publisher:水墨人生Latest update time:2014-04-04 Source: 中电网Keywords:RS232 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Introduction

This scheme is a determinant matrix keyboard interface circuit based on RS232 bit-by-bit serial communication bus implemented in VHDL language. It has the functions of reset and receiving and sending serial data. The working condition of the chip can be judged according to the display status of the light-emitting diodes led0-led2; the programs that realize all circuit functions are debugged on the field programmable chip EPM7128SLC84-15 produced by ALTERA in the United States. It can judge whether a key is pressed through dynamic scanning, convert the key value into the corresponding ASCII code value, and realize the reception and transmission of serial data under the action of clock pulses.

2. Design

1. Chip pin definition

 

 

reset reset input terminal; clk clock input terminal; rxd serial data receiving terminal; retn0-retn7 keyboard scan row input lines; txd serial data transmitting terminal; scan0-scan7 keyboard scan column output lines; led0-led2 display output terminals.

2. Connection diagram between keyboard and chip (as shown in Figure 2, it is an 8×8 64-key keyboard)

3. Dynamic scanning principle

(1) Make the column lines scan0-scan7 output 0 level in turn, and check the level status of the row lines retn0-retn7. If the levels of the row lines retn0-retn7 are all high, it means that no key is pressed. If the levels on retn0-retn7 are not all high, it means that a key is pressed.

 

 

(2) If no key is pressed, return to scanning. If a key is pressed, scan row by row to find the key number of the closed key. The process is: first set scan0=0, scan1-scan7=1, detect the level on retn0-retn7, if retn=0, it means that the key in the first row and first column is pressed, if retn1=0, it means that the key in the second row and second column is pressed, and so on; if retn0-retn7 are not 0, it means that no key in this column is pressed; then set scan1=0, detect the key in the second column, and keep looping until the closed key is found.

When a key is pressed, the scan value and retn value at that moment can be used to determine which key is pressed.

4. Chip internal module block diagram

 

 

3. Chip Design

The block diagram of the data receiving module is shown in Figure 4.

 

 

Reset reset input terminal; clk clock input terminal; rxd serial data receiving terminal; led[20] outputs the lower three bits of the ASCII code value corresponding to the pressed key to drive the light-emitting diode.

This module realizes the control function of receiving and counting serial data and serial-to-parallel conversion.

1.Serial data receiving control unit

 

 

Reset reset input terminal; clk clock input terminal; rxd serial data receiving terminal; sh_rx[30] receive counter high 4 bits; sl_rx[10] receive counter low 2 bits.

The serial data receiving counter is set to a 6-bit counter, with the upper 4 bits as sh_r and the lower 2 bits as sl_r. The status of the counter is used to realize the synchronous control and counting control of the serial data.

2. Serial-to-parallel conversion circuit unit

After the serial data received from the RXD end is converted from serial to parallel, the lower three bits are output through the LED output end, driving the light-emitting diodes LED0, LED1, and LED2 to emit light, thereby displaying the lower three bits of each data of the receiving end RXD. When the lower three bits of each data are the same, the display state does not change, otherwise it will flicker, so as to check the working condition of the chip.

IV. Conclusion

This scheme is a design of a matrix keyboard interface circuit based on RS232 bit-by-bit serial communication bus implemented in VHDL language. It has the functions of reset and receiving and sending serial data. The working condition of the chip can be judged according to the display status of the light-emitting diodes led0-led2; the program to realize all circuit functions is debugged on the EPM7128SLC84-15 chip with field programmable function produced by ALTERA in the United States. The design of this circuit is close to life and has strong practicality. After being made into a chip, it can be used as an interface between a general PC keyboard and a host.

Keywords:RS232 Reference address:Design of RS232 matrix keyboard interface

Previous article:Connecting a dummy load to a switching power supply is not something you can do whenever you want!
Next article:Circuit design of battery pack monitoring platform based on LTC6802

Latest Power Management Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号