PROGRAM CODE:
org 0000h
acall lcd
acall keyboard
lcd:
mov a,#38h //2*16 matrix lcd
acall command
mov a,#0eh //dispaly on cursor on
acall command
mov a,#01h
acall command
mov a,#06h
acall command
mov a,#80h
acall command
ljmp code2
code2:
ret
command:
acall delay
mov p1,a
clr p3.0
clr p3.1
setb p3.2
acall delay
clr p3.2
ret
data1:
acall delay
mov p1,a
setb p3.0
clr p3.1
setb p3.2
acall delay
clr p3.2
acall delay
ret
delay:
mov r0,#15h
go:mov tmod,#01h
mov tl0,#0ffh
mov th0,#0dbh
setb tr0
back:jnb tf0,back
clr tr0
clr tf0
djnz r0,go
ret
keyboard:
mov p2,#0ffh
k1:mov p0,#00h //checking of keyboard's
mov a,p2
anl a,#03h
cjne a,#03h,k1
k2:
acall delay
mov a,p2
anl a,#03h
cjne a,#03h,over
sjmp k2
over:acall delay //checking for row
mov a,p2
anl a,#03h
cjne a,#03h,over1
sjmp k2
over1:
mov p0,#0feh
mov a,p2
anl a,#03h
cjne a,#03h,row0
mov p0,#0fdh
mov a,p2
anl a,#03h
cjne a,#03h,row1
ljmp k2
row0:
mov dptr,#code0
sjmp find
row1:
mov dptr,#code1
sjmp find
find:
rrc a
jnc match
inc dptr
sjmp find
match:
clr a
movc a,@a+dptr
acall data1
ljmp k1
code0:
db '1','2'
code1:
db '4','5'
end
No comments:
Post a Comment