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 key coding of the extended keyboard complies with the conventions of the display subsystem.
(2) The communication between the extended keyboard and the display processor is completed through its asynchronous serial interface, and the baud rate is 9600 b/s.
(3) The interface level of the communication between the extended keyboard and the display processor is RS232C standard.
(4) The relative error of the baud rate should be less than 2.5%.
(5) The power supply requirement of the extended keyboard: DC +5 V.
(6) The ambient temperature requirement of the extended keyboard: -100 to +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.
2 Circuit Design
The extended keyboard consists of the following parts:
① Single chip microcomputer 89C51 and clock and reset circuit.
② TTL level to RS232C level conversion chip ICL232CPE, this chip only needs 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.
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.
①4 kB programmable E2PROM.
②8 b CPU for control.
③128 b internal RAM data memory.
④32 b bidirectional input/output lines.
⑤1 full-duplex serial port.
⑥2 16 b timers/counters.
⑦5 interrupt sources, 2 interrupt priorities.
⑧Clock generator.
⑨64 kB program memory and 64 kB external data memory can be addressed.
The 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 the key array are separated. This keyboard also overcomes the shortcomings of the previous keyboard design, such as fewer keys and non-universality.
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.
5. Issues that should be noted in application
In the serial communication of heterogeneous machines, 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, determine 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 frequency/12. This mode is synchronous; when working in mode 2, it is asynchronous, and its baud rate is Crystal frequency : ① When SMOD=0, the baud rate is: crystal frequency/64; ② When SMOD=1, the baud rate is: crystal frequency/32; When the serial interface works in modes 1 and 3, it is asynchronous 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:
The overflow rate of timer 1 is determined by the counting rate and the timing preset number X, that is:
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 is 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
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:
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:
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.
Previous article:Method of Producing Sound of Single Chip Microcomputer Alarm
Next article:Design and implementation of the interface between 51 single-chip microcomputer and CF card
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- EEWORLD University Hall----TI General Operational Amplifier
- Innovation in 5G RF front-end: from integrated modules to self-shielding technology
- Reliability of design
- UPS power supply design issues
- Buck-boost supercapacitor charging solution
- EEWORLD University - In-depth study of light load high efficiency and low noise power supply reference design for wearable devices and the Internet of Things (TIDA-01566)
- New Application of Frequency Converter in Baosteel
- Newbie asks for help from experts to recommend high-frequency square wave amplifier circuit
- AHD/TVI/CVI/CVBS to HDMI/VGA/CVBS solution sharing
- Use of transistor