Nhờ mọi người xem giúp phần lập trình led ma trận 16x80 của mình với, chữ hiển thị cứ hiện ra bên dưới rồi bên trên rồi sau đó phần vừa hiện bên dưới lại hiện bên trên và ngược lại, nói chung các bạn xem là biết, rồi chỉ cho mình xem sai ở đâu để mình sửa, cảm ơn các bạn nhiều !
đây là file mô phỏng, chạy bằng proteus 7.5 + code + file hex:
http://www.mediafire.com/?domimoztzml
còn đây là code:
ORG 000H
BIGIN:
XCLOCK BIT P3.5
DLQET BIT P3.6
XCHOT BIT P3.7
DTOUT EQU p0
DTOUT1 EQU p2
MOV DPTR,#DATA1
MOV r1,#0
HT1:
MOV R0,#20 ;(20)THOI GIAN CUA TRANG THAI MOT MAN HINH
START:
LCALL HIENTHI
DJNZ R0,START
inc dptr
CJNE r1,#80,HT1 ;cu la 224
LJMP BIGIN
HIENTHI:
PUSH ACC
push 00h
MOV R0,#00H
SETB DLQET
SCAN:
MOV A,R0
MOVC A,@A+DPTR
MOV DTOUT,A
INC R0
clr a
MOV A,R0
MOVC A,@A+DPTR
MOV DTOUT1,A
CLR XCLOCK
cpl XCLOCK
CLR XCHOT
cpl XCHOT
LCALL TRE
MOV DTOUT,#0FFH
CLR DLQET
clr a
inc R0
CJNE R0,#32h,SCAN
POP 00h
POP ACC
RET
tre:
MOV R7,#1
KT1: mov r6,#100 ;
kt2: DJNZ r6,KT2
DJNZ R7,KT1
RET
DATA1:
DB 03H,0C0H,03H,0C0H,7FH,0FEH,7FH,0FEH,7FH,0FEH,7FH,0 FEH,7FH,0FEH,7FH,0FEH,03H,0C0H,03H,0C0H,0FFH,0FFH, 0FFH,0DFH,0FFH,0C3H,0FFH,0F0H,1FH,0F8H,0C3H,0F9H,0 F3H,0F9H,0C3H,0F9H,1EH,0F8H,0FDH,0F0H,0FBH,0C3H,0F FH,0DFH,0FFH,0FFH,0FFH,0FFH
DB 0F3H,0FFH,0F3H,0FFH,0F3H,0FFH,0F3H,0FFH,03H,0C0H,0 3H,0C0H,0F3H,0FFH,0F3H,0FFH,0F3H,0FFH,0F3H,0FFH,0F FH,0FFH,03H,0C0H,03H,0C0H,7FH,0FEH,7FH,0FEH,7FH,0F EH,7FH,0FEH,7FH,0FEH,7FH,0FEH,03H,0C0H,03H,0C0H,0F FH,0FFH
DB 0FFH,0DFH,0FFH,0C3H,0FFH,0F0H,1EH,0F8H,0C5H,0F9H,0 F5H,0F9H,0C5H,0F9H,1EH,0F8H,0FFH,0F0H,0FBH,0C3H,0F DH,0DFH,0FEH,0FFH,03H,0C0H,03H,0C0H,0E7H,0FFH,8FH, 0FFH,3FH,0FFH,0FFH,0FCH,0FFH,0F1H,0FFH,0E7H,03H,0C 0H,03H,0C0H,0FFH,0FFH,0FFH,0FFH
DB 3FH,0FCH,0FH,0F0H,0E7H,0E7H,0F7H,0EFH,0F3H,0CFH,0F 3H,0CCH,0F3H,0CCH,0E7H,0ECH,0C7H,0E0H,0EFH,0F0H,0F FH,0FFH,0FFH,0FFH,0FFH,0FFH
END
đây là file mô phỏng, chạy bằng proteus 7.5 + code + file hex:
http://www.mediafire.com/?domimoztzml
còn đây là code:
ORG 000H
BIGIN:
XCLOCK BIT P3.5
DLQET BIT P3.6
XCHOT BIT P3.7
DTOUT EQU p0
DTOUT1 EQU p2
MOV DPTR,#DATA1
MOV r1,#0
HT1:
MOV R0,#20 ;(20)THOI GIAN CUA TRANG THAI MOT MAN HINH
START:
LCALL HIENTHI
DJNZ R0,START
inc dptr
CJNE r1,#80,HT1 ;cu la 224
LJMP BIGIN
HIENTHI:
PUSH ACC
push 00h
MOV R0,#00H
SETB DLQET
SCAN:
MOV A,R0
MOVC A,@A+DPTR
MOV DTOUT,A
INC R0
clr a
MOV A,R0
MOVC A,@A+DPTR
MOV DTOUT1,A
CLR XCLOCK
cpl XCLOCK
CLR XCHOT
cpl XCHOT
LCALL TRE
MOV DTOUT,#0FFH
CLR DLQET
clr a
inc R0
CJNE R0,#32h,SCAN
POP 00h
POP ACC
RET
tre:
MOV R7,#1
KT1: mov r6,#100 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