LCD1602 working principle LCD1602 LCD screen schematic LCD1602 display control

Publisher:RadiantRiverLatest update time:2024-04-29 Source: elecfansKeywords:LCD1602 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

LCD display principle

Liquid crystal is a polymer material. Due to its special physical, chemical and optical properties, it has been widely used in thin and light displays since the mid-20th century.


The main principle of Liquid Crystal Display (LCD) is to use electric current to stimulate liquid crystal molecules to produce points, lines, and surfaces which in conjunction with the back light tubes form a picture.

Now let's understand the physical properties of liquid crystal: LCD itself cannot emit light, it needs the help of light source to display, which is what we usually call backlight. When the light beam passes through this layer of liquid crystal, the liquid crystal itself will stand up in a row or twist into an irregular shape, thus blocking or allowing the light beam to pass smoothly.

Most liquid crystals are organic compounds made of long rod-shaped molecules. In their natural state, the long axes of these rod-shaped molecules are roughly parallel. When liquid crystal is poured into a well-machined grooved surface, the liquid crystal molecules will align along the grooves, so if the grooves are perfectly parallel, the molecules will also be perfectly parallel.

picture

That is to say, if the molecules on one plane are arranged in a north-south direction, the molecules on the other plane are arranged in an east-west direction, and the molecules between the two planes are forced into a 90-degree twisted state. Since light propagates along the direction of the molecular arrangement, the light is also twisted 90 degrees when passing through the liquid crystal. But when a voltage is applied to the liquid crystal, the molecules will rearrange vertically, allowing the light to be emitted directly without any twisting.

A polarizing filter is actually a series of increasingly thin parallel wires. These wires form a web that blocks all light that is not parallel to them. The wires of the polarizing filter are perpendicular to the first, so they completely block light that has already been polarized. Light can only pass through if the wires of the two filters are completely parallel, or if the light itself has been twisted to match the second polarizing filter.

Therefore, by applying voltage through these polarizers in specific directions, light can be allowed to pass through some areas, while light is blocked in other areas. The image of these alternating light and dark points arranged in certain pixels is the information we want to display.

picture

The 1602 LCD display module contains a driver chip HD44780 (HITACHI) or other compatible chips, and provides a library of 192 characters that users can call directly. It can display two lines of characters, each line includes 16 display character blocks composed of 5×8 dot matrix blocks, each dot matrix block is a character position, and the character spacing and line spacing are both the width of one dot.

Next Steps

LCD1602 display control

After understanding the LCD display principle, how can we make it display characters? To do this, we must first understand the characteristics and control methods of its internal driver chip. The microcontroller controls the display driver and also needs to communicate. Here we have to mention the timing that we have been emphasizing before. In the previous section, when we explained UART, we knew that UART communication has strict timing requirements, so it requires precise baud rate control. Although the LCD control timing does not need to be as precise as UART, it also requires certain requirements. Let's first take a look at its common interfaces and pin descriptions.

picture

●VSS: Power ground pin.

●VDD: power supply pin.

●Vo: LCD display bias signal pin, apply 0 ~ 5V voltage to adjust the display contrast.

●RS: Register selection pin, when it is high level, it selects the data register; when it is low level, it selects the instruction register.

●R/W: Read and write operation selection pin, high level is read operation; low level is write operation.

●E: Enable signal pin, low level is valid.

●DB0 ~ DB7: Data bus pins, used to input data to drive the 1602 LCD module display.

●A: Backlight 5V power pin.

●K: Backlight ground signal pin.

Now let's understand its control timing:

picture

As can be seen from the figure, the timing changes of the three control pins RS, R/W, and E in its read and write operations are different. And there are also differences between data and instructions, so it can be specifically divided into the following four situations:

Read status - input: RS=L, R/W=H, E=H; output: D0~D7=status word.

Read data - Input: RS=H, R/W=H, E=H; Output: None.

Write instruction - input: RS=L, R/W=L, E=H, D0~D7=instruction code, E=H; output: D0~D7=data.

Write data - Input: RS=H, R/W=L, E=H, D0~D7=data, E=H; Output: None.

The display's internal driver chip has an 80-byte RAM buffer, and its addresses correspond to the following:

picture

But we know that the display interface can only display 16*2 characters at most, so how does it handle all the buffers internally?

When writing display data to any of the addresses 00H~0FH and 40H~4FH in the figure, the LCD can display it immediately; but when writing to addresses 10H~27H or 50H~67H, they must be moved into the displayable area through screen shift instructions for normal display.

The built-in string distribution table of the display is as follows:

picture

The control instructions of the display driver are as follows:

picture

There is a lot of information above, and some of it is not fully listed, so I will not list it here one by one. You don’t need to memorize it when using it, just refer to the information to program.

LCD1602 Display Example

The above introduces the main contents related to the 1602 LCD display. Now let's draw a simple circuit diagram and then program and test it.

picture

In this circuit, we connect the display data port to P0, and the other three control pins to P2.2~P2.4.


Now let's program it to display some simple characters:


/*


* This is a LCD1602 display program


*The purpose is to display some characters on the display


*/


#include


#include


#define DB1602 P0 //1602 data port


typedef unsigned char u8;


typedef unsigned int u16;


sbit rs_1602=P2^2;


sbit rw_1602=P2^3;


sbit en_1602=P2^4;


void delay(u8 ms);


void lcd1602_check_busy();


void Write_Byte_1602(u8 Byte,bit dat);


void lcd1602_Init();


void Write_char1_1602(bit x,u8 y,u8 dat1);


void Write_string_1602(bit x,u8 y,u8 *str);


void main(void)


{


lcd1602_Init();




Write_string_1602(0,0," Hello guy!");


Write_char1_1602(1,6,'-');


Write_string_1602(1,7,"--LCD1602");




while(1)


{



}

}


void delay(u8 ms)


{


u8 i,j;




for(i=0; i


{


for(j=0; j<110; j++)


{


;


}


}

}


void lcd1602_check_busy()


{


u8 busy;


bit via;


do


{


rs_1602=0;


rw_1602=1;


DB1602|=0xf0;


en_1602=1;


busy=DB1602;


en_1602=0;


en_1602=1; //


en_1602=0; //


via=(bit)(busy&0x80);

}while(via);


}


void Write_Byte_1602(u8 Byte,bit dat)


{


lcd1602_check_busy(); //Wait if busy


rs_1602=dat; //Data command selection bit


rw_1602=0;


en_1602=1;


DB1602=Byte;


_nop_();


en_1602=0;

}


void lcd1602_Init()


{


Write_Byte_1602(0x38,0); //Set 16×2 display, 5×7 dot matrix, 8-bit data interface


Write_Byte_1602(0x08,0);


Write_Byte_1602(0x01,0); //Clear screen


Write_Byte_1602(0x06,0); //Display cursor movement settings


Write_Byte_1602(0x0c,0); //Display on and cursor setting

}


void Write_char1_1602(bit x,u8 y,u8 dat1)


{


if(x==0)


{


Write_Byte_1602(0x80+y,0);


}


else


{


Write_Byte_1602(0xc0+y,0);


}


//dat1+=0x30;


Write_Byte_1602(dat1,1);

}


void Write_string_1602(bit x,u8 y,u8 *str)


{


if(x==0)


{


Write_Byte_1602(0x80+y,0);


}


else


{


Write_Byte_1602(0xc0+y,0);


}


while(*str)


{


Write_Byte_1602(*str,1);


str++;


}

}


This code looks a little more complicated than the original program, but it is still some basic content, so everyone should understand it first. If you don’t understand something, you can look up the information first. This program uses something I haven’t mentioned before - pointers, which I will list separately and explain later.


0dd6c8eb828b271686eddf8c85e9b1c9_wKgZomRtr5mAfg8KAAHFMfv-gn0553.jpg

Keywords:LCD1602 Reference address:LCD1602 working principle LCD1602 LCD screen schematic LCD1602 display control

Previous article:Design case of intelligent dormitory air conditioning management system based on HMI-Board
Next article:Analysis of the Limiting Circuit in Digital Power Amplifier

Recommended ReadingLatest update time:2024-11-16 09:58

51 MCU Tutorial (VII): LCD1602 Liquid Crystal Display Module
1. Principle Introduction Liquid crystal display modules have the advantages of small size, low power consumption, rich display content, ultra-thin and light, etc., and are increasingly widely used in embedded application systems. The LCD1602 liquid crystal display module introduced in this lecture (its internal contr
[Microcontroller]
51 MCU Tutorial (VII): LCD1602 Liquid Crystal Display Module
LCD1602 screen displays email and mobile phone numbers (scrolling and flashing display program Proteus simulation)
Learned how to use LCD to display two lines of email and phone number Three display modes: direct display, scrolling display , flashing display, simulation schematic diagram as follows, single chip source program as follows: #include reg51.h sbit rs=P2^0;  sbit rw=P2^1; sbit en=P2^2; #define uint unsigned int #de
[Microcontroller]
LCD1602 screen displays email and mobile phone numbers (scrolling and flashing display program Proteus simulation)
Design of Bluetooth electronic scale based on 51 single chip microcomputer
1. Hardware Solution The hardware of this design mainly consists of 51 single-chip microcomputer + minimum system + LCD1602 liquid crystal display module + HX711 module + LED module + buzzer module + matrix button module + 10kg pressure sensor; as shown in the figure: 2. Design function (1) The LCD1602 display shows
[Microcontroller]
Design of Bluetooth electronic scale based on 51 single chip microcomputer
LCD1602 4-wire connection
Although the display screen and displayed characters of LCD1602 are small and not very practical, it is still a commonly used output display device in general teaching experiments. There are 11 lines connecting LCD1602 and MCU, including 8 data lines and 3 control lines. If all of them are connected, more MCU interfa
[Microcontroller]
LCD1602 4-wire connection
Latest Embedded Articles
Change More Related Popular Components
Guess you like
    502 Bad Gateway

    502 Bad Gateway


    openresty

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号