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.
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.
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 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.
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
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:
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 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
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:Overall design of multi-way calling system
Next article:Design of Intelligent Simple Vehicle System Based on AT89S52
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Download ADS software for free | PathWave helps you meet high-speed digital design challenges
- Wireless data acquisition, environmental monitoring, gas monitoring, remote temperature and humidity monitoring, chemical environmental monitoring solutions
- Registration is open | TI live award-winning broadcast: Current and voltage measurement solutions in servo drives
- Playing with Zynq Serial 44——[ex63] Image smoothing processing of MT9V034 camera
- Help! CCS7.3 enters the exit.c file after entering debug mode. I don't know how to solve it
- Share Gigabit Ethernet port circuit design
- [RVB2601 creative application development] 2. CH2601 serial port receiving
- How to draw this shape in Protel 99se
- A summary of the most downloaded electronic technical materials this week (2020.5.1~9), each one is a classic
- [i.MX6UL development problem] How to use tftp to burn program in uboot