industrial control system:

org 00h
rs equ p3.7
rw equ p3.6
en equ p3.5
lcd equ p2
mov p0,#00h
mov lcd,#38h
acall cmd
acall delay
mov lcd,#01h
acall cmd
acall delay
mov lcd,#0eh
acall cmd
acall delay
mov lcd,#06h
acall cmd
acall delay
mov lcd,#80h
acall cmd
acall delay
mov tmod,#20h
mov th1,#0fdh
mov scon,#50h
setb tr1
again: jnb ri,$
mov a,sbuf
mov r5,a
mov lcd,a
acall disp
cjne r5,#'F',s1
mov r7,#0ffh
hr: mov p0,#05h
djnz r7,hr
s1: cjne r5,#'B',s2
mov r7,#0ffh
hr1: mov p0,#0ah
djnz r7,hr1
s2: cjne r5,#'L',s3
mov r7,#0ffh
hr2: mov p0,#08h
djnz r7,hr2
s3: cjne r5,#'R',s4
mov r7,#0ffh
hr3: mov p0,#01h
djnz r7,hr3
s4: clr ri
sjmp again

cmd: clr rs
clr rw
setb en
acall delay
clr en
ret

disp: setb rs
clr rw
setb en
acall delay
clr en
ret

delay: mov r1,#0efh
l2: mov r2,#0ffh
l1: djnz r2,l1
djnz r1,l2
ret

end

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Microcontroller Projects -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -