Understand LCD1602 liquid crystal display module in 10 minutes

Publisher:德州小孙Latest update time:2019-12-16 Source: 51heiKeywords:LCD1602 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction to LCD1602 Liquid Crystal Module


What does LCD1602 mean? LCD stands for Liquid Crystal Display, and 1602 means that 16 characters can be displayed in one line, and there are two lines in total. The actual picture is as follows:
01.jpg


2. Thinking Analysis

LCD1602 is a display module, and its main function is of course display. Since it is a display, we can think about it, it is nothing more than two contents:
First point: where do you want it to display (display position)
Second point: what content do you want to display (display content)
Obviously, these two points are controlled by the microcontroller. What the microcontroller tells it to display, it will display, and where the microcontroller tells it to display, it will display. This sentence can also be said in another way, such as the microcontroller "tells" the LCD1602 module: Please display the character 'A' at the 4th position of the 1st line. The so-called "telling" is that the microcontroller and the LCD1602 module are "communicating". Compare it with our usual "communication", such as making a phone call, do you start talking about the topic right away. Of course not. You need to send a signal first, such as "Hello", to say hello, and make sure that the other party can receive the signal before you start talking about the topic. Of course, some people will ask about each other's well-being before starting the conversation.


In short, there must be a "greeting" process before "communication". The same is true for the "communication" between the microcontroller and LCD1602. You also need to "say hello" first, but we have changed the term "initialization" here.


In this way, the whole idea comes out:
Step 1: Initialization (the microcontroller says hello to 1602 first)
Step 2: Determine the display position (the microcontroller tells 1602 where to display)
Step 3: Determine the display content (the microcontroller tells 1602 what to display)


3. The idea of ​​operation steps
comes out, and the following is to implement it according to this idea. How to implement it, of course, depends on the manual given by the manufacturer of the LCD1602 liquid crystal module you are using.


3.1 Initialization
How to initialize? The 1602 manual has already told you, you don't even need to think about it, just do it.


Delay 15ms

Write instruction 38H

Delay 5ms

Write instruction 38H

Write instruction 08H

Write instruction 01H

Write instruction 06H

Write instruction 0CH


3.2 Determine the display position
How to determine the display position? As mentioned earlier, the display position is 2 lines, each line has 16 spaces, so there are 32 spaces in total. So how does the MCU tell LCD1602 which space to display? Note that the MCU and LCD1602 are both machines. Since it is a communication between machines, of course, machine language must be used. Since it is a machine language, it is nothing more than a language composed of 0 and 1. So the question now is how to determine the display position through 0 and 1. This is relatively easy. For example, if I only use one bit, then I can only determine two positions, using 0 to indicate the first space of the first line to display, and using 1 to indicate the second space of the first line to display. As mentioned earlier, 1602 has 32 spaces, and it is obvious that one bit is definitely not enough. In the same way, if two bits are used, there are 4 combinations, that is, 4 spaces can be determined, and if three bits are used, there are 8 spaces, which is still not enough. Then continue to increase the number of bits, and five bits will be enough. For example, when the microcontroller sends the information 00000 to 1602, it means that it should be displayed in the first space of the first line, 00001 means it should be displayed in the second space of the first line, and so on. However, usually the communication between machines is based on bytes (8 bits) as the smallest unit, so we can determine the display position by the combination of 8 bits of 0 and 1. As for the specific combination method corresponding to what position, you need to check the manual provided by the manufacturer. The

Display location.png 


manual has clearly pointed out the combination of 8 bits of 0 and 1. Its highest bit is fixed to 1, and the remaining 7 bits are determined by the above table. For example, when the remaining 7 bits are 40H, it means
it should be displayed in the first space of the second line of 1602. When the remaining 7 bits are 4FH, it means it should be displayed in the 16th space of the second line.

3.3 Display content
The remaining question is how to determine the display content. Similarly, the display of content is also completed through the combination of 8 bits of 0 and 1. The different combinations of these 8 bits correspond to different display contents, as shown in the figure below. For example,

Display content.png


when the MCU sends 00110000 to 1602, it means telling 1602 to display character 0, and so on.


This brings up a new problem. When the MCU sends 1000 0100 to 1602, how does it know whether this information is "position" information or "content" information? Both types of information are composed of 8 bits of 0 and 1. How to distinguish them? We define "position" information as "command" and "content" information as "data". So how does the MCU tell 1602 whether it is sending a "command" or "data"? This question can be explained in detail. The above explanation is very clear.


The steps are sorted out. The following is to implement how the MCU sends a byte (command/data) to 1602 by referring to the timing diagram.

Keywords:LCD1602 Reference address:Understand LCD1602 liquid crystal display module in 10 minutes

Previous article:51 single chip microcomputer temperature control fan production digital tube display Proteus simulation program
Next article:C51 MCU uses ESP8266 to configure WIFI and send temperature data source code

Recommended ReadingLatest update time:2024-11-23 11:21

STM32 MCU (9) LCD1602 display output experiment
The core code is provided by kingsraywii. The author of this article integrates it, annotates it in more detail, and improves some of the code. The chip ID acquisition, string output and printf redirection output functions are added. Note: When using the Puzhong Technology Development Board for testing, you need to un
[Microcontroller]
pic16f877 connected to LCD1602 liquid crystal display
//#include #include pic.h #define uchar unsigned char #define rs RC0 #define rw RC1 #define en RC2 #define data PORTD   const uchar tab ="Welcometo Earth!";   void delay(float y) {     fly x;     for(;y 0;y--)         for(x=110;x 0;x--); }   void check_busy() {     flying tempo;
[Microcontroller]
pic16f877 connected to LCD1602 liquid crystal display
51 single chip microcomputer - LCD1602 LCD screen C language programming
LCD1602: 1602 LCD is also called 1602 character LCD. It can display 2 lines of character information, and each line can display 16 characters. It is a dot matrix LCD module specially used to display letters, numbers, and symbols. It is composed of several 5x7 dot matrix character bits, each of which can be used to dis
[Microcontroller]
51 single chip microcomputer - LCD1602 LCD screen C language programming
LCD1602 four-wire programming method program design example
The first time I adjusted the 4-line LCD 1602, it was quite difficult, either because of the wrong delay or the wrong command. It took me a whole day to get the 4-line 1602 programming implementation. Here are the programs for 51 MCU and LPC23XX series MCU. I found the 51 program on the Internet. You can refer to the
[Microcontroller]
Latest Microcontroller Articles
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号