LCD1602 setting
Author:Mao Xingdong Time:2021-07-20 16:53 Browse(260)
Original publisher: 1170430041
Original publisher: 1170430041.
.

LCD1602 setting

operation steps: initialize write command (rs=L) set display coordinate write data (rs=h) 1: LCD1602 key command setting 1. Clear screen command function: clear LCD.
that is to fill all contents of DDRAM with "blank" ASCII code 20h; Return the cursor to the top left of the LCD screen; Set the value of the address counter (AC) to 0.
2. Enter the mode setting command function: set the shift direction of the cursor after each input of 1 bit data.
and set whether a character written in each time moves.
the parameter setting is as follows: bit name setting I / d0=cursor moves left after writing new data 1=cursor moves right after writing new data S0=display does not move after writing new data 1=write After entering the new data, the display screen moves one character to the right. 3. Display switch control command function: control the display on / off, cursor display / off and whether the cursor flickers.
the parameter settings are as follows: bit name setting d0=display function off 1=display function on C0=no cursor 1=with cursor B0=cursor flickering 1=cursor not flickering 4. Function setting command function: set the number of data bus bits The parameter settings are as follows: dl0=4 bits for data bus, 1=8 bits for data bus, N0=1 line for display, 1=2 lines for display, F0=5 × 7 dot matrix / 1=5 per character × 10 dot matrix / two per character: after setting, we need to know where to display.
where to display? In the initialization of the LCD module, the display mode should be set first, and the cursor is automatically shifted to the right when the LCD module displays characters, without manual intervention.
it is necessary to judge whether the LCD module is in a busy state before each command input.
the LCD module is in a busy stateDDRAM is the display data RAM.
used to.
write one!! 38h is to set the LCD display format to 2 lines.
8 bits, 5 * 7 display.
just make sure that 160 is in idle state in the front.
otherwise, the data will be lost! The delay is long enough, but you can't make sure that he is in the idle state. It's better to write a busy time detection program to give you a reference program.
busy:; Check whether the LCD is busy.
mov P1.
0ffh; P1 is the data input and output port.
CLR rs.
setb RW.
CLR E.
NOP.
setb E.
JB P1.7.
busy; If P1.7 is high, it means busy, wait in a circle.
I hope these are helpful to you
ret.
.
Related topics