Embedded tester designed with C8051F020

Publisher:Jinyu2022Latest update time:2010-12-23 Source: 电子元器件应用Keywords:C8051F020 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:C8051F020 Reference address:Embedded tester designed with C8051F020

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

Servo valve temperature zero drift measurement and control system based on C8051 F020
The automatic measurement and control system with high-performance single-chip C8051F020 as the core control chip can automatically measure temperature, automatically output linear current at the temperature measurement point, automatically collect load pressure, etc., and calculate, display and print test data. Its re
[Test Measurement]
Servo valve temperature zero drift measurement and control system based on C8051 F020
Embedded tester designed with C8051F020
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
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号