Detailed explanation of a 4-wire connection of LCD1602

Although the display screen and display characters of the LCD1602 are both small and practical, it is still a common output display device in general teaching experiments.

There are 11 lines connecting the LCD1602 to the microcontroller, including 8 data lines and 3 control lines. If they are all connected, they will occupy more interfaces of the microcontroller.

The LCD1602 also has a connection method using a high 4-bit data line, which can reduce the burden on the microcontroller.

In addition, the control of the RW is not necessarily required. If it is merely used to read the state of the LCD 1602 being "busy", it can be replaced with a little wait. In this way, RW can be directly grounded, leaving LCD 1602 permanently in the write state.

So, only need 6 lines between LCD1602 and one-chip computer, this is the most simple connection method of LCD1602.

The following example uses the upper 4 bits of port P0 to connect to the upper 4-bit data line of LCD1602. P2.0 is connected to RS and P2.1 is connected to EN.

The subroutine for writing output to LCD1602 is as follows:

LCD_W_DATA:;LCD1602 data line D7~D4 connect P0 high four

CALLWAIT5MS; Wait

PUSHACC; Save

SETBLCD_RS; RS=1, data

ORLA, #0FH; Low 4 Position One

MOVP0,A; write high four

CALLENABLE; gives a positive pulse at EN

POPACC; Recovery

SWAPA; high and low four exchange

ORLA, #0FH; Low 4 Position One

MOVP0, A; write low four

CALLENABLE; gives a positive pulse at EN

RET

In the program, the upper 4 bits are output and the lower 4 bits are output. This is done according to the data transmission specification of the 4-wire connection method of the LCD1602.

During output, the lower 4 bits of P0 are set to make it in the input state. In this way, the lower 4 bits can be used as the input interface of the button.

The subroutine for writing commands to the LCD 1602 is similar to the above procedure except that RS=0 is required.

However, it should be noted that when it is initialized to 4 bits, 8 bits should be used.

The circuit for making a perpetual thermometer using the LCD1602, DS18B20 is as follows:

Detailed explanation of a 4-wire connection of LCD1602

This circuit has been made in kind. After several days of actual measurement, it can be seen that the time accuracy is very high, which is no less than the scheme using the DS1302.

The temperature display program can display temperatures below zero and over 100 degrees.

You can use 4 keys to control, long press “SET” to enter the setting state; after short press “SET”, you can change the currently set items in turn.

Only after pressing “SET” again can you exit the setting.

In the setting state, the currently selected item will be displayed in blinking. At this time, press “plus” or “minus” again to modify it.

In the program, it has the function of automatically calculating the flat year and calculating the day of the week, so only the year, month, and day can be set.

In the program, an alarm clock function was designed to set an exact time to the second. When you are in trouble, you can also set it to be busy or not busy.

In fact, it's easy to do a lot of things when designing a lot of troubles, so that you can use it as a timing controller, for example, for school bells.

Query Machine All-in-one

Query Machine All-In-One,Product Display Touch Screen Horizontal,Lcd Capacitive Touch Screen Advertising Display,Advertising Display Kiosk Capacitive Touch Screen

Jumei Video(Shenzhen)Co.,Ltd , https://www.jmsxdisplay.com