Below are the position of the first character of the second line of the LCD displays the letter "a" in the program: ORG 0000H
RS EQU P3.7; determine the specific hardware connections
RW EQU P3.6; determine the specific hardware connections
E EQU P3.5; determine the specific hardware connections
MOV P1,#00000001B; clear screen and the cursor is reset
ACALL ENABLE; write command is invoked subroutine
MOV P1,#00111000B; set display mode: 8 bit 5x7 2 line dot matrix
ACALL ENABLE; write command is invoked subroutine
MOV P1,#00001111B; display open, open the cursor, cursor blinking allows
ACALL ENABLE; write command is invoked subroutine
MOV P1,#00000110B; text does not move the cursor move automatically to the right
ACALL ENABLE; write command is invoked subroutine
MOV P1,#0C0H; write to display start address (second line of the first position)
ACALL ENABLE; write command is invoked subroutine
MOV P1,#01000001B; the code letter a
SETB RS RS=1
CLR RW;RW=0; prepare written data
CLR E;E=0; display command is executed
ACALL DELAY, and judge whether the LCD is busy?
SETB E;E=1; displays a completion, the program stop
AJMP $
ENABLE:
CLR RS; write control command subroutines
CLR RW
CLR E
ACALL DELAY
SETB E
RET
DELAY:
MOV P1,#0FFH, and determine whether the LCD is busy subroutines
CLR RS
SETB RW
CLR E
NOP
SETB E
JB P1.7,DELAY; if P1.7 is high level, said busy cycle wait
RET
END
10 X LCD1602 1602 module