Professional Documents
Culture Documents
;
START OF THE PROGRAM
;
;This program is to display using graphical lcd
;
;
;=====================================================================
;=====================================================================
;
ALIAS NAMES
;=====================================================================
;lcd
l_cs1
bit
p3.3
;high to low pulse to enable the lcd
l_cs2
bit
p3.4
l_rs
bit
p3.5
l_rw
bit
p3.6
l_en
bit
p3.7
l_DATA
equ
p2
;to move port data contents to lcd
;=====================================================================
org 0000h
;origin of code memory
;=====================================================================
;RESERVED FOR INTERRUPTS.
;=====================================================================
sjmp MAIN
;jump to main to begin the program execution
org
0030h
setb
clr
l_cs1
l_cs2
mov
dptr, #lcdinit
to the db ditective stored value
c1x:
clr
a
;
movc
a,
@a+dptr
;value stored on code memory moved to reg a
jz
to_ret
;if 0 all comand sent to lcd
acall comwrt
;command send to lcd
acall delay
;a optimum delay of initialisation process
inc
dptr
;if not 0 fetch another command value
sjmp
c1x
to_ret:ret
lcd_init_2:
clr
setb
;points
l_cs1
l_cs2
mov
dptr, #lcdinit
to the db ditective stored value
c2x:
clr
a
;
movc
a,
@a+dptr
;value stored on code memory moved to reg a
jz
to_ret
;if 0 all comand sent to lcd
acall comwrt
;command send to lcd
acall delay
;a optimum delay of initialisation process
inc
dptr
;if not 0 fetch another command value
sjmp
c2x
;column 1
setb
l_cs1
clr
l_cs2
mov
dptr, #data0
to the db ditective stored value to print
mov
r4,#0
mov
r5,#0b8h
d_here2:mov
a,r5
acall comwrt
d_here1:mov
a,#40h
acall comwrt
D1x:
clr
a
;
movc
a,@a+dptr
;value stored on code memory moved to reg a
;
acall datawrt
;datas send to lcd
acall delay
;a optimum delay of initialisation process
;points
lcd_data_1:
;points
inc
;if 0 all datas sent to
inc
cjne
acall
setb
clr
inc
r5
mov
cjne
ret
DPTR
lcd
r4
r4,#64,d_here1
column2
l_cs1
l_cs2
r4,#0
r5,#0c0h,d_here2
column2:
d_here3:mov
clr
setb
mov
mov
mov
acall
a,#40h
acall
clr
l_cs1
l_cs2
r4,#0
r6,#0b8h
a,r6
comwrt
comwrt
a
;
movc
a,@a+dptr
;value stored on code memory moved to reg a
;
acall datawrt
;datas send to lcd
acall delay
;a optimum delay of initialisation process
inc
DPTR
;if 0 all datas sent to lcd
inc
r4
cjne
r4,#64,d_here3
ret
comwrt:
datawrt:
lcd_clear1:
setb
setb
clr
clr
acall
setb
mov
acall
clr
ret
l_rs
l_rw
delay
l_en
l_data,a
delay
l_en
l_rs
clr
acall
setb
mov
acall
clr
ret
l_rw
delay
l_en
l_data,a
delay
l_en
l_cs1
clr
mov
l_cs2
r4,#0
mov
r5,#0b8h
mov
a,r5
c_here2:
acall comwrt
mov
a,#40h
acall comwrt
c_here1:
inc
lcd_clear2:
clr
mov
call
inc
cjne
r5
mov
cjne
ret
l_cs1
setb
mov
mov
a,#00h
datawrt
r4
r4,#64,c_here1
r4,#00h
r5,#0c0h,c_here2
l_cs2
r4,#0
r5,#0b8h
c_here4:
mov
a,r5
acall comwrt
mov
a,#40h
acall comwrt
c_here3:
inc
mov
call
inc
cjne
r5
mov
cjne
ret
a,#00h
datawrt
r4
r4,#64,c_here3
r4,#0
r5,#0c0h,c_here4
DELAY:
mov
R3,#2
;a delay of minimum 1ms required
HERE2: MOV
r2,#235
;
here1: djnz
r2,here1
djnz
r3,here2
;
ret
delay1:
;1 second
loopd3: mov
loopd2: mov
loopd1: djnz
mov
r3,#4
r2,#250
r1,#230
r1,loopd1
djnz
r2,loopd2
djnz
r3,loopd3
ret
;=====================================================================
;
END OF THE PROGRAM
;=====================================================================
org
lcdinit:
page 0 ,column 0
data0:
db 3Fh,0b8h,40h,0
db
end
0FD0h
;to data appear,