Beruflich Dokumente
Kultur Dokumente
The control pins help us configure the LCD in command mode or data mode.
They also help configure read mode or write mode and also when to read or
write.
LCD 16x2 can be used in 4-bit mode or 8-bit mode depending on the
requirement of the application. In order to use it we need to send certain
commands to the LCD in command mode and once the LCD is configured
according to our need, we can send the required data in data mode.
; P2.0 EQU RS
; P2.1 EQU RW
; P2.2 EQU E
ORG 0000H ;
MOV A, #38H ; INITIATE LCD
ACALL COMMWRT ;
ACALL DELAY ;
Data
AGAIN :
SJMP AGAIN ;
COMMWRT:
MOV P1, A ;
CLR P2.0 ; RS = 0 FOR COMMAND REGISTER
CLR P2.1 ; R/W = 0 FOR WRITE
SETB P2.2 ; E = 1 FOR HIGH PULSE
ACALL DELAY ;
CLR P2.2 ; E = 0 FOR LOW PULSE
RET
DATAWRT:
MOV P1, A ;
SETB P2.0 ; RS = 1 FOR DATA REGISTER
CLR P2.1 ; R/W = 0 FOR WRITE
SETB P2.2 ; E = 1 FOR HIGH PULSE
ACALL DELAY ;
CLR P2.2 ; E = 0 FOR LOW PULSE
RET
DELAY :
MOV R3, #50H ;
BACK:
MOV R4, #255H ;
HERE:
DJNZ R4, HERE ;
DJNZ R3, BACK ;
RET
END
8/28/2018 RVS TCC MPMC BY PRADEEV