e có đoạn code led ma trận nhưng mà khi e quét bằng 74hc595 thì ở p0 của e nó chỉ xuất ra có 1 hàng dữ liệu đâu tiên còn các hàng còn lại nó ko xuất dữ liệu ra đc các bác sửa giúp e với cảm ơn nhiều
dulieu bit p2.1
clk bit p2.0
oe bit p2.4
xuat bit p2.2
clr_ bit p2.3
org 0h
clr dulieu
clr clk
setb oe
clr xuat
clr clr_
setb clr_
;--------------------------------------------
main:
mov dptr,#matran
main1:
setb dulieu
mov r2,#0h
mov b,#0
rep:
mov a,b
movc a,@a+dptr
mov p0,a
inc b
setb clk
clr dulieu
clr clk
setb xuat
clr xuat
clr oe
lcall delay
inc r2
setb oe
cjne r2,#8,rep
clr clr_
setb clr_;
;inc dptr
;mov a,dpl
;cjne a,#32,rep
sjmp main
;-----------------------------------------------
delay:
mov r6,#25
del: mov r5,#2
djnz r5,$
djnz r6,del
ret
matran:
DB 6DH,0ABH,0C7H,0H,0C7H,0ABH,6DH,0FFH
DB 6DH,0ABH,0C7H,0H,0C7H,0ABH,6DH,0FFH
DB 9BH,9DH,0FDH,0FDH,9DH,9BH,0FFH,0FFH
DB 18H,5AH,0H,0DBH,0DBH,0H,5AH,18H
DB 0FFH,0H,0EFH,0EFH,0EFH,0H,0FFH,0FFH
DB 0FFH,7EH,7EH,0H,7EH,7EH,0FFH,0FFH
DB 0FFH,0H,6EH,6EH,6EH,7EH,0FFH,0FFH
DB 0FFH,1H,0FEH,0FEH,0FEH,1H,0FFH,0FFH
DB 0FFH,0H,6FH,6FH,9FH,0FFH,0FFH,0FFH
end
dulieu bit p2.1
clk bit p2.0
oe bit p2.4
xuat bit p2.2
clr_ bit p2.3
org 0h
clr dulieu
clr clk
setb oe
clr xuat
clr clr_
setb clr_
;--------------------------------------------
main:
mov dptr,#matran
main1:
setb dulieu
mov r2,#0h
mov b,#0
rep:
mov a,b
movc a,@a+dptr
mov p0,a
inc b
setb clk
clr dulieu
clr clk
setb xuat
clr xuat
clr oe
lcall delay
inc r2
setb oe
cjne r2,#8,rep
clr clr_
setb clr_;
;inc dptr
;mov a,dpl
;cjne a,#32,rep
sjmp main
;-----------------------------------------------
delay:
mov r6,#25
del: mov r5,#2
djnz r5,$
djnz r6,del
ret
matran:
DB 6DH,0ABH,0C7H,0H,0C7H,0ABH,6DH,0FFH
DB 6DH,0ABH,0C7H,0H,0C7H,0ABH,6DH,0FFH
DB 9BH,9DH,0FDH,0FDH,9DH,9BH,0FFH,0FFH
DB 18H,5AH,0H,0DBH,0DBH,0H,5AH,18H
DB 0FFH,0H,0EFH,0EFH,0EFH,0H,0FFH,0FFH
DB 0FFH,7EH,7EH,0H,7EH,7EH,0FFH,0FFH
DB 0FFH,0H,6EH,6EH,6EH,7EH,0FFH,0FFH
DB 0FFH,1H,0FEH,0FEH,0FEH,1H,0FFH,0FFH
DB 0FFH,0H,6FH,6FH,9FH,0FFH,0FFH,0FFH
end