Implementation and design of interface circuit and program for liquid crystal display based on microcontroller C8051F020

Publisher:忠正Latest update time:2024-01-12 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Application of single chip C8051F020 in liquid crystal display control system

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.

Application of single chip C8051F020 in liquid crystal display control system

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.

Application of single chip C8051F020 in liquid crystal display control system

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


Reference address:Implementation and design of interface circuit and program for liquid crystal display based on microcontroller C8051F020

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

Single chip perpetual calendar (LCD12864, DS18B20, DS1302)
1. Introduction This circuit consists of AT89C51 minimum circuit board, LCD12864 display module, DS18B20 temperature module and DS1302 clock module. The main functions are: display real time and current temperature. 2. Operation Effect 3. Partial Code /*Want more projects private wo!!!*/ #include reg51.h #inclu
[Microcontroller]
Single chip perpetual calendar (LCD12864, DS18B20, DS1302)
Measurement method of power consumption of LCD display module
1. Measurement Schematic Diagram Description K1 K2 K3 are the settings of the LCD module. K1 is the WDT selection switch. When the switch is closed, WDT is turned on. Otherwise, WDT is turned off . K2 is the TONE selection switch. When the switch is closed, audio output is turned on. Otherwise, it is
[Embedded]
Measurement method of power consumption of LCD display module
Summary of LCD1602 based on 51 single chip microcomputer to realize minute and second timing
Completion requirements 1. Realize the timing of minutes and seconds. 2. Use buttons to control the adjustment of minutes and seconds (two buttons control the increase of minutes and seconds respectively). 3. Realize the function of telling time in whole and minute (buzzer sounds). 4. Drawing and welding of PCB board
[Microcontroller]
Summary of LCD1602 based on 51 single chip microcomputer to realize minute and second timing
LCD12864 driver
#include msp430g2553.h #include "lcd12864.h" #include "typedef.h"   #define cyCS BIT0 //P2.0, chip select signal #define cySID BIT1 //P2.1, serial data #define cyCLK BIT2 //P2.2, synchronous clock #define cyPORT P2OUT #define cyDDR P2DIR void Write_8bits(u8 W_bits) {       u8 i;       cyDDR |= cyCLK + cySID;   //设置输
[Microcontroller]
LGD AP3 production line stops producing iPhone LCD panels, turns to automotive panels in the future
CINNO Research Industry News, LG Display (hereinafter referred to as LGD) has interrupted the production of Apple iPhone LCD panels. The original production line for iPhone LCD panels will be converted to automotive panels.   According to Korean media Thelec, LGD stopped producing Apple iPhone LCD panels in the third
[Embedded]
LGD AP3 production line stops producing iPhone LCD panels, turns to automotive panels in the future
The key problem has been solved: LCD screens can finally use screen fingerprints
For most mid-to-high-end smartphones, the screen fingerprint function has become an indispensable selling point, but consumers must have discovered that the current mobile phones using screen fingerprints basically use AMOLED screens, which will inevitably make some consumers who are dissatisfied with AMOLED screens f
[Home Electronics]
The key problem has been solved: LCD screens can finally use screen fingerprints
Global LCD screen shipments hit a record high. Huawei's support has made BOE's current success possible?
BOE's core businesses include terminal devices, smart IoT, and smart medical engineering. Terminal device products are widely used in mobile phones, tablets, laptops, monitors, TVs, cars, wearable devices and other fields; smart IoT builds an IoT platform for new retail, transportation, finance, education, art, medica
[Embedded]
LCD1602 usage program in PIC microcontroller
#include pic.h __CONFIG(0x1832);         //Chip configuration word, watchdog off, power-on delay on, power-off detection off, low voltage programming off, encryption, 4M crystal HS oscillation #define rs RA1 #define rw RA2 #define e RA3 const char web ={' ','W','W','W','.','P','I','C','1','6','.','C','O','M',' ',' '}
[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号