How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

Publisher:qq8174350Latest update time:2014-08-28 Source: cecb2b Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  In the information processing system, the display subsystem is the human-machine interface of the entire system. The situation graphics and data presented on the display screen are important bases for people to make decisions. Human intervention means are an indispensable tool to turn people's decisions into information that the system can receive. Therefore, the amount and effectiveness of human intervention means directly affect the effectiveness of the entire system. Especially in systems that process large amounts of information and have frequent human-computer interactions, the requirements for human intervention means are higher.

  Based on the actual work, the author designed a universal asynchronous serial interface keyboard around the single-chip microcomputer 89C51 as an extended keyboard for the display subsystem. The purpose is to add an intervention method for the display subsystem. Practice shows that this keyboard improves the human-machine interface of the system and improves the processing efficiency of the system.

  1 Design requirements and working principles

  1.1 Design requirements

  (1) The extended keyboard key encoding complies with the conventions of the display subsystem.

  (2) The extended keyboard communicates with the display processor through its asynchronous serial interface with a baud rate of 9600 b/s.

  (3) The interface level for communication between the extended keyboard and the display processor is RS232C standard.

  (4) The relative error of baud rate should be less than 2.5%.

  (5) Power requirement for extended keyboard: DC +5 V.

  (6) Ambient temperature requirement for extended keyboard: -100~+500°C.

  1.2 Working Principle

  The working principle of the extended keyboard is shown in Figure 1. The extended keyboard is connected to the display processor through an asynchronous serial interface. Together with the standard keyboard, the display processor has two keyboards. The two keyboards can send intervention commands to the display processor at the same time. Therefore, the display subsystem adds a new way to input intervention commands, shortens the input time of intervention commands, and improves the efficiency of manual intervention.

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  2 Circuit Design

  The extended keyboard consists of the following parts:

  ① Single chip microcomputer 89C51 and clock and reset circuits.

  ②TTL level to RS232C level conversion chip ICL232CPE, this chip only needs a DC +5 V power supply.

  ③Working indication circuit.

  ④Key array part (8×13).

  The electrical schematic diagram of the extended keyboard is shown in Figure 2.

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  3 Structure and performance characteristics of 89C51

  89C51 is one of the typical products of MCS-51 series microcontrollers. Its internal hardware resources are shown in Figure 3.

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  ①4 kB programmable E2PROM.

  ②8 bit CPU for control.

  ③128 B internal RAM data storage.

  ④32 b bidirectional input/output line.

  ⑤1 full-duplex serial port.

  ⑥2 16b timers/counters.

  ⑦5 interrupt sources, 2 interrupt priorities.

  ⑧Clock generator.

  ⑨ Can address 64 kB of program memory and 64 kB of external data memory.

  This keyboard uses the E2PROM on the chip of 89C51 as program storage to avoid the external storage occupying the input/output port resources of the single-chip microcomputer; uses the second function of the P3 port to complete the asynchronous serial communication function; uses an ICL232CPE as an interface level conversion chip to realize the entire hardware logic of the keyboard. Less hardware and high reliability. The entire keyboard uses a +5 V DC power supply; the circuit and key array are separated. This keyboard also overcomes the shortcomings of previous keyboard designs such as fewer keys and non-universality. [page]

  4 Software Function Flowchart

  The software implements functions such as key position scanning, jitter elimination, key code conversion, and key code sending. In addition, the software also implements the functions of shifting and key bursting. The software function flow chart is shown in Figure 4.

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  5. Issues that should be noted in application

  In the serial communication of different models, after the transmission rate is specified, it is very important to select the appropriate crystal oscillator frequency in the MCS-51 microcontroller system. It, together with the working mode of the serial interface, the SMOD bit of the power control register PCON, and the timer T1, determines the success or failure of the communication. When the serial interface of the MCS-51 microcontroller works in mode 0, its baud rate is fixed and its size is: crystal oscillator frequency/12. This mode is synchronous mode; when working in mode 2, it is asynchronous mode, and its baud rate is

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  Crystal frequency: ①When SMOD=0, the baud rate is: crystal frequency/64; ②When SMOD=1, the baud rate is: crystal frequency/32; The serial interface works in mode 1 and 3 in asynchronous mode and its baud rate is variable. In addition to being related to the value of the SMOD bit, it mainly depends on the overflow rate of timer 1. The baud rate can be determined by the following formula:

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  The overflow rate of timer 1 is determined by the counting rate and the timing preset number X, that is:

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  At this time, T1 works in mode 2, that is, 8-bit automatic loading mode. This mode can avoid reloading the initial value through the interrupt service program, and the baud rate obtained is also more accurate. In the formula, X is the initial count value loaded in TH1 and TL1. The counting rate of timer 1 is related to the selection of the timer working mode. When T1 is selected as the timing working mode, its counting input pulse is the internal clock signal, that is, the register value is increased by 1 in each machine cycle. And each machine cycle is 12 oscillation cycles, so the counting rate is 1/12 of the crystal frequency. Therefore

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  Since the serial communication between this extended keyboard and the display processor is asynchronous, the working mode of its serial interface is set to mode 1, and the working mode of timer 1 is set to mode 2. Then calculate its preset value according to the baud rate requirement (9 600 b/s). If the oscillation frequency of the system crystal is 12 MHz, when SMOD is selected as 1, the initial values ​​of TH1 and TL1 are calculated as follows:

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  Solving the above equation, we can get: X1=250(FAH) or X2=249(F9H)

  When X is placed in TH1, TL1, the actual transmission rate generated by the baud rate generator is:

How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

  Or baud rate 2 = 8 928.57 b/s, baud rate error 2 = 7%

  No matter which number is set, the PC and the MCU cannot communicate normally. If a 11.059 2 MHz crystal is used, X=250 FAH is calculated according to the above formula, and the actual transmission rate is 9 599.83 b/s, the error is 0.001 77%, and the communication between the PC and the MCU can be carried out normally. In addition, the selection of the SMOD bit can sometimes affect the baud rate error. Therefore, when setting the baud rate, the selection of the SMOD bit should also be carefully considered.

  When designing a key array, the conductive rubber membrane key array of a standard keyboard should be used to avoid old-style keys that have a short service life and often have poor contact.

  6 Conclusion

  The function design of this keyboard can be further refined, such as realizing caps lock, keypad lock, etc. Since the amount of data communicated between the keyboard and the host is not large, the USB port is not used to communicate with the host. With a little modification, the USB port can be used to communicate with the host. If this keyboard is used in some systems that do not use serial communication, it can be directly connected with TTL level, eliminating the ICL232CPE chip, making the circuit simpler, and the P3 port can use parallel output.

Reference address:How to improve system processing efficiency by using extended keyboard designed by single chip microcomputer

Previous article:Overall design of multi-way calling system
Next article:Design of Intelligent Simple Vehicle System Based on AT89S52

Latest Microcontroller 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号