0 Introduction
With the continuous development of measurement and control technology, it has become a development trend to apply embedded operating systems to the field of measurement and control to achieve online real-time testing. In addition, more and more industrial sites have increasing demands for various test instruments, and hope that test instruments can develop in the direction of online real-time testing. Based on these needs, this paper gives a design scheme for the keyboard display part of the tester based on C8051F020 control. In the entire embedded test system, this part only serves as a lower computer and communicates with the upper computer through the RS485 bus interface, so that the received test data is displayed on the display according to the requirements of the control command, and at the same time, various request signals sent by the tester are sent back to the upper computer to process the test data.
1 System hardware design
The hardware of this system consists of four parts: MCU module (C8051F020), power module, display module (OCM320240K), matrix keyboard module, etc. The overall hardware design block diagram of the system is shown in Figure 1. Among them, the externally expanded buffer memory and FLASH memory in this design. It solves the problem of mismatch between high-speed data reception and processing and small character library capacity.
1.1 MCU module C8051F020
C8051F020 is a high-performance single-chip microcomputer launched by Cygnal Corporation of the United States. It is a fully integrated mixed-signal system-level chip. Its appearance has completely changed people's impression that the 8051 single-chip microcomputer is slow and has low performance. C8051F020 uses Cygnal's patented high-speed, pipeline structure and CIP-51 microprocessor core that is fully compatible with the MCS-51 instruction set. CIP-51 has taken a new approach to improving the speed of 8051. While keeping the CISC structure and instruction system unchanged, the chip can implement pipeline operation for instruction operation, thus abolishing the concept of machine cycle. Its instructions are based on clock cycles as the operating unit. On average, one single-cycle instruction can be executed per clock cycle, which greatly improves the instruction operation speed. It is a high-speed, high-performance single-chip microcomputer with relatively complete functions.
The main reason for choosing this single-chip microcomputer as the MCU of the tester in this system design is that, on the one hand, CIP-51 is fully compatible with MCS-51 instructions, and the standard 8051 assembler, compiler and software package can be used for software development, which is also very convenient for users to transplant software; on the other hand, it can make full use of its rich universal digital port resources without address/data line multiplexing, and the design of its peripheral circuit can be greatly simplified. Since the low port (P0, P1, P2, P3) of the chip can be addressed by bit or by byte, the control signals required by the system are designed in the low port part; while the high port (P4, P5, P6, P7) can only be addressed by byte, so the data and address buses of the MCU and the display module, memory and other modules are designed in the high port part; the rich port resources of C8051F020 and the flexibility of their allocation are realized by using the priority cross switch decoder; and all pins use 5V voltage. And they can be configured as open drain or push-pull output mode and weak pull-up.
1.2 LCD Module OCM320240K
80% of the information humans obtain comes from vision, and all kinds of information are ultimately displayed to achieve human-computer exchange. Since liquid crystal display devices (LCDs) have low operating voltage, low power consumption, are directly driven by CMOS circuits, and are light and easy to carry, they have been very popular since their appearance, and naturally become the preferred display device for products such as smart meters.
The single-chip microcomputer in this system uses indirect control to control the liquid crystal module. That is, the data system of the single-chip microcomputer is not used, but its I/O port is used to achieve contact with the liquid crystal module. When designing, the data bus of the liquid crystal module can be connected to the P1 port of the single-chip microcomputer as the data bus, and the other three timing control signal lines are usually controlled by the unused I/O port in the P3 port of 8051. This access method does not occupy the memory space of the CPU, its interface circuit is independent of the timing, and its timing is completely realized by software programming.
The PCB board of the graphic dot matrix LCD module OCM320240K contains a complete driver system (built-in SED1335 LCD controller), and its interface system includes the control signals and power supply required by the driver system. Its row and column drivers are both KS0086, and the LCD bias circuit is composed of 4 operational amplifiers. The dot matrix LCD controller SED1335 can realize the functions of text, graphics, menus, page turning and left and right movement of the LCD through its interface and programming with the single-chip microcomputer. Modulating the parameters such as phase, peak value, and frequency of the potential signal output to the electrode of the LCD device can establish an AC driving electric field, thereby realizing LCD display.
1.3 Power supply module
For portable embedded testers used in industrial sites, DC power supply can be considered. The three power supplies required for this system are +5 V, +3.3 V, and -23 V. Among them, +3.3 V is used to power the C8051F020 chip. -23 V is the large negative voltage driving power supply required by the LCD, and +5 V is the logic power supply for the driver and other chips. The design of the power module adopts external dual power supply. The +8 V and -33 V DC power supplies can provide the above three voltages respectively after passing through the voltage stabilizing circuit. The specific circuit design is shown in Figure 2, where the LED lights connected to the +5 V and +3.3 V power supply interfaces can be used as power indicator lights. The lights are on to indicate that the power is on. The capacitors in the circuit are used for power filtering.
1.4 Matrix keyboard module
The design of the keyboard module adopts an interrupt-mode non-encoded 8×8 matrix keyboard. In order to save power consumption, pull-up resistors are selected in the design. The row and column lines of the buttons are connected to the P2 and P3 ports of the MCU respectively, and INT0 is connected to the P0.2 port of the MCU as an external interrupt. The buttons include 0 to 9 numeric keys, control keys such as "OK", "Cancel", "Up", and "Down" for menu display, and other basic function keys required by the test system.
1.5 External expansion circuit
The external expansion circuit in this design has two parts: one is the external expansion of the high-speed cache memory. Since the data received by the tester from the host computer through the RS485 bus may be high-speed data, and the high-speed bus data and the processing speed of the display module may not match, it is necessary to consider using an external expansion cache to meet the 64 KB display RAM requirement in the display module. The test data can also be displayed on a split screen. This article uses the 128 KB SRAM chip STC62WV1024; the second is to expand a FLASH memory to add a power-off protection function to the tester so that the test data will not be lost in the event of a sudden power outage. The more important purpose is that since the user-defined character library CGRAM capacity of the display module is small, it is considered to store the built national standard basic character library in the external expansion FLASH, and the MCU will dynamically manage it according to user needs, and continuously complete the required display character library call-in and call-out operations. This can not only meet the requirements of a large-capacity character library, but also achieve real-time scheduling. This design uses the K9F2G08U chip.
2 Software Design of Display Module
2.1 LCD Initialization
The reason why the display function of the LCD is so powerful is that in addition to its own hardware display function, it is more important to realize various display functions through software design, including basic display and extended function display composed of basic display. However, before use, it is generally necessary to select initialization parameters according to the characteristics of the LCD display module to initialize it. The initialization process is shown in Figure 3, and the specific initialization code is as follows:
2.2 Chinese Character Display
SED1335 determines the first address of the character in the character library through the character code, and sends the corresponding font data to the LCD display module. The 16×16 dot matrix block of the character that appears on the LCD screen is actually the 16×16 dot matrix on the display screen corresponding to a byte in the text display RAM. The user-defined character library CGRAM in the display memory is displayed through SED1335. The user can write the corresponding character code in the corresponding unit, and then realize the Chinese character display by calling the subroutine. The following is part of the program code to display the Chinese character "Welcome":
Since the capacity of CGRAM is limited, it is possible to consider placing the user-defined national standard basic character library in the external FLASH, and then the MCU will dynamically load the required character library from the FLASH character library according to the test data type and user needs and temporarily store it in CGRAM. By expanding the display module's custom character library, the display function of OCM320240K can be made more complete and powerful. Thus, it is more suitable for display in various fields.
2.3 Menu display
The menu display design of the LCD module should be consistent with the menu structure on the ordinary microcomputer as much as possible (that is, a tree-shaped topology structure) to adapt to the operator's operating habits. The menu display in this design is realized with the cooperation of the keyboard. In order to simplify the operation, the control keys related to the menu display in the keyboard are generally set with basic functions such as "OK", "Cancel", "Up", and "Down". These keys can be used to operate the menu display program and command execution program. The keyboard response and menu display process are shown in Figure 4. During operation, press the "OK" key, and the screen will display the next level menu; and press the "Up" and "Down" keys, the flashing cursor will move between the menu items of the same level menu to indicate the currently selected menu. When numbering each level of menu, you can set two variables mn and ln to represent the current menu number and the line where the cursor is located (the first line is 0, and so on). When the program is initialized, mn=0, ln=0; use the "OK" key to change the menu number (mn=mn×2+ln), the "Cancel" key to change the menu number (mn=[mn/2]), and the "Up" and "Down" keys to change the cursor position (ln=ln±1). For example, menu No. 12 is obtained by pressing the "OK" key when the cursor position of menu No. 5 is on the third line (ln=2), and its number is 5×2+2=12. After determining the menu number and cursor position, call the display program (or function execution program) to display the new level menu and reset the cursor position. The routine code is as follows:
3 Conclusion
After completing the software and hardware design, the circuit board of this design can be debugged to realize its display function. At present, the cascade debugging of this system and the host computer is still in progress. In addition, considering the increasing use of touch screens, this system also considers the interface with the display module DV320240F with a touch screen controller (ADS7843) in the circuit design, so as to add touch function as needed in the future.
Previous article:Design of universal controller for solar water heater based on AFS600
Next article:Design of OLED control circuit based on C8051F
Recommended ReadingLatest update time:2024-11-16 17:42
- Popular Resources
- Popular amplifiers
- Practice of Serial Communication between Single Chip Microcomputer and Computer (Zhang Xiuguan)
- Design of SD card main controller based on c8051f020
- C8051F020 implements ADC sampling of analog voltage outside the chip, displays it on the LCD, and sends it to the PC through the serial port
- ADC application elements in C8051F020 (scheme design).rar
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!
- 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
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Post count 1234, mark it here
- Open Source ESP32 Color Screen WIFI/BLE Smart Multimeter Production Process (1. Shell and Screen Selection)
- TI Automotive IC Products and Application Solutions (Free Viewing)
- B station hands-on expert shares: How to "trick" USB charger
- Differentiated innovative product-LED transparent screen
- TI's affordable Li-ion battery pack reference design for electric motorcycle batteries
- EEWORLD University Hall----Live Replay: Manufacturing Logistics Challenges of Microchip Key Security Configuration- Advantages of Discrete Security Elements
- Please tell me what is the reason for this, the transistor is connected to the single chip
- HC32L136 official routine error solution
- MSP430 Study Notes 3-PWM Generation