Cho em hỏi về đt nội bộ. Sao phát một số đi ko được. Xin chi giúp, sơ đồ phần cứng và phần mềm
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxx
b1 bit p1.0
b2 bit p1.1
b3 bit p1.2
b4 bit p1.3
rw bit p1.4
rs bit p1.5
cs bit p1.6
org 00h
mov tmod,#11h
clr p3.1
setb p3.0
call delay90
call startup8880
call cai_dat
mov a,#1h
call setup
call delay90
mov a,#0ah
call setup
call delay90
mov a,#05h
call setup
call delay90
setb p3.1
jmp $
startup8880:
mov p1,#0ffh
mov p1,#00110000b
call delay90
mov p1,#00110000b
mov p1,#01110000b
mov p1,#00100000b
call delay90
mov p1,#00100000b
mov p1,#01100000b
mov p1,#00100000b
call delay90
mov p1,#00100000b
mov p1,#01100000b
mov p1,#00101000b
call delay90
mov p1,#00101000b
mov p1,#01101000b
mov p1,#00100000b
mov p1,#00100000b
mov p1,#01100000b
mov p1,#00110000b
call delay90
mov p1,#00110000b
mov p1,#01110000b
ret
setup: mov p1,#0ffh
x0: clr cs
mov c,b1
setb cs
jnc x0
;anl a,#0fh
orl a,#11000000b
mov p1,a
clr cs
setb cs
ret
cai_dat:
MOV P1,#11101001B
MOV P1,#10101001B
MOV P1,#11100000B
MOV P1,#10100000B
RET
delay90:
mov r7,#2
del1: mov th0,#high(-50000)
mov tl0,#low(-50000)
setb tr0
jnb tf0,$
clr tf0
clr tr0
djnz r7,del1
ret
end
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxx
b1 bit p1.0
b2 bit p1.1
b3 bit p1.2
b4 bit p1.3
rw bit p1.4
rs bit p1.5
cs bit p1.6
org 00h
mov tmod,#11h
clr p3.1
setb p3.0
call delay90
call startup8880
call cai_dat
mov a,#1h
call setup
call delay90
mov a,#0ah
call setup
call delay90
mov a,#05h
call setup
call delay90
setb p3.1
jmp $
startup8880:
mov p1,#0ffh
mov p1,#00110000b
call delay90
mov p1,#00110000b
mov p1,#01110000b
mov p1,#00100000b
call delay90
mov p1,#00100000b
mov p1,#01100000b
mov p1,#00100000b
call delay90
mov p1,#00100000b
mov p1,#01100000b
mov p1,#00101000b
call delay90
mov p1,#00101000b
mov p1,#01101000b
mov p1,#00100000b
mov p1,#00100000b
mov p1,#01100000b
mov p1,#00110000b
call delay90
mov p1,#00110000b
mov p1,#01110000b
ret
setup: mov p1,#0ffh
x0: clr cs
mov c,b1
setb cs
jnc x0
;anl a,#0fh
orl a,#11000000b
mov p1,a
clr cs
setb cs
ret
cai_dat:
MOV P1,#11101001B
MOV P1,#10101001B
MOV P1,#11100000B
MOV P1,#10100000B
RET
delay90:
mov r7,#2
del1: mov th0,#high(-50000)
mov tl0,#low(-50000)
setb tr0
jnb tf0,$
clr tf0
clr tr0
djnz r7,del1
ret
end
Comment