BM Dept., Govt. Engg. College, Gandhinagar Page 35
between two data which gives enough time to LCD for its operation and does not require
to check the status whether it is busy or not.
Program:
; For Kit prepared for LAB
; Program to Display text message on LCD
; Port 1 Drives data lines, P2.1-RS, P2.0 EN,RW is grounded
RS EQU P2.1
RW EQU P2.1
EN EQU P2.0
DATA equ P0
org 00h
MOV P0,#00h ; Port P0 output port
MOV P2,#00h ; Port P2 output port
MOV A,#38h ;Initialize LCD, 2 lines, 5X7 matrix
acall command ;Issue command to the LCD
MOV A,#0eh
acall command ;LCD ON, Cursor ON
MOV A,#01h
acall command ;Clear LCD
MOV A,#06h
acall command ;Shift cursor right
MOV A,#80h
acall command ;Force cursor at beginning of the first line
MOV DPTR,#msg ;Point to text message
acall disp_msg ;Display message on second line
here: sjmp here
command:
acall delay ;Write when display not busy
clr RS ;Select command register
clr RW
mov DATA,A
setb EN ;Set Enable terminal of LCD
nop
nop
clr EN
ret
disp_data:
acall delay
mov DATA,a ;Get data for display
clr RW
setb RS ;Select data register
setb EN ;Enable LCD (Strobe LCD)
nop
nop
clr EN ;Clear Enable and latch data
ret
disp_msg:
Comments to this Manuals