In the design of single-chip computer systems, the design of the 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 smart instruments. This article combines the design requirements of the electrolyte analyzer and uses the liquid crystal display module YXD-12864A2LCM to study and implement the interface circuit and program design of the liquid crystal display based on the single-chip computer C8051F020, and adds a button system to facilitate user use.
1 Introduction to electrolyte analyzer
The electrolyte analyzer (Electrolyte Analyzer) designed in this system is a high-resolution and high-precision instrument that can be used with a variety of ion-selective electrodes. It can use automatic methods to measure potassium, sodium, chlorine, and calcium ions in samples. concentration and pH. Its structural block diagram is shown in Figure 1. The instrument is designed using the single-chip computer 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 the output is displayed on the LCM. LCM The display of parameters and measurement results can all be operated by the keyboard. For communication with the host computer, RS 232 communication method is used to transmit data. The characteristic of this instrument is that it can be used as a stand-alone machine or connected to a host computer. After being connected to the host computer, the interface operation can help users complete functions such as querying and storing patient information, and real-time detection of instrument working conditions.
Figure 1 Structural block diagram of electrolyte analyzer
The system display part uses the graphic liquid crystal display module YXD-12864A2LCM, which is installed on the surface of the instrument to display parameter settings, measurement results, calibration, quality control, etc. Functions such as interface display, parameter setting and page turning are realized through button control.
2 YXD-12864A2LCM
2.1 Module introduction
YXD-12864A2LCM is a graphic dot matrix liquid crystal display module, which is mainly composed of row drivers, column drivers and 128x64 full dot matrix LCD. It can complete graphic display and can also display 4x8 (16x16 dot matrix) Chinese characters. The YXD-12864A2 module has a total of 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 driving power supply; the 4th pin D/I is connected to the data command selection signal; the 5th pin R/W is connected to the read and write selection signal; pin 6 is connected to the read and write enable signal. When E is high, the data is read out, and when the falling edge of E arrives, the data is latched to DB0~DB7; pins 7~14 are connected to the tri-state data bus ; The 15th and 16th pins are connected to the chip select signal; the 17th pin 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 pole of the LED backlight power supply; the 20th pin is connected to the negative pole 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 used as a data port to connect to the DB port of the LCD module; P2.0 is the reset pin control terminal; P2.1, P2.4, and P2.5 are used as Ordinary I/O ports are used, which are respectively connected to the enable terminal E of the liquid crystal module, the register selection pin D/I, and the read and write pin R/W; P2.2 and P2.3 are respectively connected to the chip select signal left or right. Position the display.
Figure 2 LCM interface circuit diagram
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 working voltage is 5 V, while the working voltage of C8051F020 is 3.3 V. To make the output of C8051F020 better To drive a 5 V input LCM, each port must be connected to the 5 V power supply through a pull-up resistor, so as to ensure that the logic "1" output of the C8051F020 can be boosted to 5 V.
Figure 3 Interface circuit schematic diagram
2.3 Software design
Display characters: Display the specified string starting from the specified position on the screen. This LCM is a 128x64-bit LCD, and the dot matrix occupied by each character is 8x8. The display position is determined by two coordinate parameters. The abscissa x represents "row", and the value range is 0 to 7; row 0 Corresponds to the top line of the screen, and line 7 corresponds to the bottom line. The ordinate y represents "column", and the value range is 0 to 15. Column 0 corresponds to the leftmost column of the screen, and column 15 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 program segment is as follows:
;entrancd:C(left,right),R4(X),R5(Y),DPTR,R6(length)
data_to_lcd:
SETB CS1_LCD
CLR CS2_LCD
JNC data_to_lcd2
CLR CS1_LCD
SETB CS2_LCD
data_to_lcd2:
MOV A,R4
LCALL display_X_line
MOV A,R5
LCALL display_Y_line
MOV A,R6
MOV R7,A
LCALL write_LCD_bytes
MOV A,R4
INC A
LCALL display_X_line
MOV A,R5
LCALL display_Y_line
MOV A,R6
MOV R7,A
INC DPTR
LCALL write_LCD_bytes
CLR CS2_LCD
CLR CS1_LCD
RIGHT
SETB C; chip select setting
MOV R4, #04H; position line number
MOV R5, #08H; position column number
MOV DPTR, #K; character content
MOV R6, #08; defines the length of characters
LCALL data_to_lcd; call the subroutine that outputs characters
Previous article:Design of drilling wellbore attitude monitoring system using C8051F060 based on MATLAB environment
Next article:Design solution of multi-protocol bus integrator based on C8051F120
Recommended ReadingLatest update time:2024-11-16 09:52
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
- Baobaobao~~~After the Chinese New Year, what new developments are there in the evaluation industry? Hurry up and take a look at the Evaluation Intelligence Bureau~
- [NUCLEO-L552ZE Review] Small thermometer
- STM3L4R5 driver for hts221 and stts751
- Cytech’s award-winning live broadcast: Let you learn about ADI’s digital health biosensor series live!
- Evaluation Weekly Report 20220406: Germany's PHYTEC's i.MX 8M+ AI board and RTT Renesas high-performance CPK-RA6M4 are here
- Is this post of the study club incomplete? The formula part?
- [NXP Rapid IoT Review] + Review the Bluetooth function and learn how to program the application
- I need help with a fully digital phase-locked loop Verilog code and modelsim simulation
- Solving for the transfer characteristic curve of an op amp
- What does the typical transmission distance of an infrared receiver mean?