Application of C8051F020 in LED display control system

Publisher:廿由人Latest update time:2021-04-22 Source: eefocusKeywords:C8051F020  LED Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Preface


In the design of single-chip microcomputer system, the design of LCM (liquid crystal display module) human-computer interaction interface is often a very important link. LCM can be used to display setting parameters, status prompts, test results and parameters to be input on intelligent instruments. In combination with the design requirements of electrolyte analyzer, this paper adopts YXD-12864A2LCM produced by Shenzhen Yexinda Industrial Co., Ltd., studies and implements the interface circuit and program design of LCD based on C8051F020, and adds a key system to achieve the purpose of user convenience.


1 Introduction to Electrolyte Analyzer


The electrolyte analyzer designed in this system is an instrument with high resolution and high precision. It can be used with a variety of ion selective electrodes and can automatically determine the concentration and pH value of potassium, sodium, chloride, and calcium ions in samples. Its structural block diagram is shown in Figure 1. The instrument is designed with the single-chip microcomputer C8051F020 as the core chip. In the measurement room, the chemical sensor collects the potential signal of the electrolyte and transmits it to the signal conditioning circuit. After signal conditioning, it is sent to the main circuit board for A/D conversion, and then output and displayed on the LCM. The display of LCM parameters and measurement results can be operated by the keyboard. In terms of communication with the host computer, RS 232 communication is used to transmit data. The characteristics of this instrument are that it can be used alone or connected to the host computer. After connecting to the host computer, the interface operation can help users complete the query and storage of patient information and the real-time detection of the working status of the instrument.

The system display part uses a graphic LCD module YXD-12864A2LCM, which is installed on the surface of the instrument to display parameter settings, measurement results, calibration, quality control, etc. The interface display, parameter setting, page turning and other functions are realized through key control.


2 YXD-12864A2LCM


2.1 Module Introduction


YXD-12864A2LCM is produced by Shenzhen Yexinda Industrial Co., Ltd. It is a graphic dot matrix LCD display module, which mainly consists of row driver, column driver and 128×64 full dot matrix LCD display.


It can display graphics and 4×8 (16×16 dot matrix) Chinese characters. The YXD-12864A2 module has 20 pins. Among them, the 1st pin VSS is connected to the system ground; the 2nd pin VDD is connected to the power supply voltage; the 3rd pin V0 is connected to the LCD display drive power supply; the 4th pin D/I is connected to the data instruction selection signal; the 5th pin R/W is connected to the read-write selection signal; the 6th pin is connected to the read-write enable signal. When E is high, the data is read out, and when the falling edge of E arrives, the data is latched into DB0~DB7; the 7th to 14th pins are connected to the three-state data bus; the 15th and 16th pins are connected to the chip selection signal; the 17th pin RST- is connected to the reset signal; the 18th pin Vout is connected to the output voltage terminal of the internal negative voltage generator; the 19th pin is connected to the positive electrode of the LED backlight power supply; the 20th pin is connected to the negative electrode of the LED backlight power supply.


2.2 Interface Circuit


The interface circuit diagram and schematic diagram are shown in Figure 2 and Figure 3. The P3 port of C8051F020 is connected to the DB port of the LCD module as the data port; P2.0 is the reset pin RST-control terminal; P2.1, P2.4, and P2.5 are used as ordinary I/O ports, respectively connected to the enable terminal E, register selection pin D/I, and read/write pin R/W of the LCD module; P2.2 and P2.3 are respectively connected to the chip select signal left or right to position the display.


In the circuit diagram of Figure 2, R28 and R41 are pull-up resistors, because each port is connected to the microcontroller. For the display, the operating voltage is 5 V, while the operating voltage of C8051F020 is 3.3 V. In order to make the output of C8051F020 better drive the LCM with 5 V input, each port should be connected to the 5 V power supply through a pull-up resistor, so that the logic "1" output of C8051F020 can be increased to 5 V.


2.3 Software Design


Display characters: Display the specified string from the specified position on the screen. This LCM is a 128×64-bit LCD screen, and each character occupies an 8×8 dot matrix. The display position is determined by two coordinate parameters. The horizontal coordinate x represents the "row" and the value range is 0~7; the 0th row corresponds to the top row of the screen, and the 7th row corresponds to the bottom row. The vertical coordinate y represents the "column" and the value range is 0~15. The 0th column corresponds to the leftmost column of the screen, and the 15th column corresponds to the rightmost column of the screen.


Assuming that the character "K" is to be displayed from the 4th row and 8th column, the display of Chinese characters is similar to that of characters, except that the dot matrix occupied by Chinese characters is in the form of 16×16. Therefore, in this LCM, Chinese characters can only be displayed in 4 rows and 8 columns. The coordinates of the first row of Chinese characters are 00H~07H, and the coordinates of the second, third, and fourth rows are 10H~17H, 20H~27H, and 30H~37H respectively. To display Chinese characters, the coordinate starting position of the Chinese characters must be written as a command, and the Chinese character font must be written as data. To continuously write multiple Chinese characters, the table lookup method can be used.


3-button system


The hardware design of the key system can be done in two ways: independent and matrix.


(1) In the independent type, each key occupies an I/O port line separately. The working status of the key on each I/O port line will not affect the status of other I/O port lines. It is generally used in occasions with a small number of keys; (2) The keys of the matrix type are arranged in a row-column matrix structure, with 4 rows and 4 columns, a total of 16 keys, occupying only 8 I/O port lines. Therefore, when the number of keys is large, this method can be used to save I/O port lines.


This instrument defines 8 buttons in total. Considering that the I/O interface on C8051F020 is very rich, an independent type is adopted. A total of 8 buttons are designed on the instrument, namely "Yes", "No", "↑(up)", "↓(down)", "←(left)", "→(right)", "Reset" and "Print". Except for the "Reset" button (which is directly reset after being pressed), which is not processed by the keyboard information processing program, the pressing processing of the remaining 7 keys is completed by the keyboard information processing program in the main loop program. For independent buttons, the CPU can obtain the direct state code value of the button by directly reading the state of the I/O port, and the button can be directly identified based on this value. The code value of each key is shown in Table 1.

The specific definition of the buttons is as follows:


(1) “↑(up)”, “↓(down)”, “←(left)”, “→(right)”: move the cursor or switch screens with different contents, modify data, complete password input, etc.;


(2) "Yes": confirm the operation, including confirming the selected menu item or data, confirming the entered password, confirming the modified data, etc.;


(3) “No”: You can cancel the entered password value or modified data;


(4) "Reset": soft reset system;


(5) “Print”: Control the printer to print output.


The working modes of keys are divided into two types: programming control mode and interrupt control mode. This instrument adopts interrupt control mode, and the flow chart is shown in Figure 4. This mode can improve the efficiency of the CPU. When a key is pressed, an interrupt is requested from the CPU. After the CPU responds to the interrupt, the keyboard scan, key value check and processing are performed in the interrupt service program. The programming control mode means that within a working cycle, the key scanning subroutine is called using the spare time of completing other tasks. After the program query, if there is no key operation, it returns; if there is a key operation, it further determines which key it is and executes the corresponding key processing program. This affects the efficiency of the CPU. Therefore, the interrupt control mode is selected.

The key switch used in this instrument is a mechanical elastic switch. It takes several milliseconds of jitter time from the key being pressed to the contact being stable, and there is also such a problem when releasing it. The length of the jitter time is determined by the mechanical characteristics of the key, which is generally 5~10 ms. This will cause multiple readings of a key. For the jitter problem, a software method can be used. It can be avoided by delaying the jitter method, that is, after detecting that the key is closed, a delay program is executed to generate a 20 ms delay, and the state of the key is detected again after the front edge jitter disappears. If the closed state level is still maintained, it is confirmed that the key is really pressed. When the key is released, a 20 ms delay is also given, and the key processing program can only be transferred after the back edge jitter disappears.


4 Conclusion


The display interface of the electrode quality analyzer is designed using the YXD-12864A2 graphic LCD display module. The 8-bit parallel mode is used to transmit data. The main reason is that although it occupies more I/O pins, it is much simpler to program than the serial mode. In addition, the C8051F020 has 8 8-bit I/O ports and 64 digital I/O pins, which are very rich, so there is no need to consider the problem of insufficient pins. By adding a key system, the displayed content can be operated by the user, which is very convenient.

[1] [1]
Keywords:C8051F020  LED Reference address:Application of C8051F020 in LED display control system

Previous article:8051 MCU Data Description
Next article:Design of electric vehicle seesaw using 51 single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 12:25

NXP Dimmable Mains LED Driver Solution
LEDs have been used in electronic systems for many years, primarily as indicator lights for electronic devices. Now significant advances in brightness and color depth mean that LEDs can now be used in a wider range of applications, from backlighting in mobile phones and multimedia players, to automotive dashboards and
[Power Management]
NXP Dimmable Mains LED Driver Solution
Design of LED dot matrix display control system based on PIC32 single chip microcomputer
Introduction: LED dot matrix display is a large display system that integrates microelectronics technology, computer technology, and information processing technology. It has become an ideal choice for many display media and outdoor work displays due to its bright colors, wide dynamic range, high brightness, long life
[Microcontroller]
Design of LED dot matrix display control system based on PIC32 single chip microcomputer
A design that eliminates electrolytic capacitors and optimizes LED drive circuits
  Aiming at the problem that the electrolytic capacitor in the existing LED driving circuit limits the life, a design method for LED driving circuit without electrolytic capacitor is proposed. This method uses Panasonic MIP553 chip with built-in PFC dimmable LED driving circuit, and synthesizes it with external non-is
[Power Management]
A design that eliminates electrolytic capacitors and optimizes LED drive circuits
LED power supply and its basic driving circuit design
There are three main types of original power sources   for LED power supply : low-voltage batteries, solar cells and AC mains power supply. No matter which original power source is used, it must be converted to meet the working conditions of the LED. This power conversion circuit generally refers to the LED drive cir
[Power Management]
LED power supply and its basic driving circuit design
Apple continues to collaborate with Epistar on next-generation Micro LED
It is reported that in order to further enhance the user experience of iPad and Mac Book, Apple is expected to gradually introduce MiniLED technology into new products next year to upgrade the color rendering and contrast of the device display as the main selling point of the new products. Therefore, it has been urgin
[Embedded]
LED Applications of S5PV210 (Part 2)
Prepare for analysis This time we use C language to control the LED. We need to set the stack pointer. The start.S here is like crt0.o in the helloworld program with an operating system - it is a startup code. The stack pointer is set to 0xD003_7D80. Resource Tools Same as "LED Application of S5PV210 (I)" Star
[Microcontroller]
PIC microcontroller button controls PWM output LED light brightness C language program
#include pic.h //Call the header file. You can go to the PICC software to find the header file of the PIC16F87XA microcontroller. __CONFIG(0x3b31); //Define configuration word, crystal type: XT, enable gate dog, disable low voltage programming //************************************************************************
[Microcontroller]
General performance requirements of LED drivers
LEDs face many challenges. For example, the forward voltage will change with changes in temperature and current, and the forward voltage of LEDs from different individuals, batches, and suppliers will also vary. In addition, the "color point" of the LED will also drift with changes in current and temperature.   In
[Power Management]
General performance requirements of LED drivers
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号