Em dùng reads51 ko biên dịch được đoạn code này. anh nào pro xem hộ em với.
DULIEU BIT P3.0
CLK BIT P3.1
CHAR EQU P1
org 0000h
start:
mov a,#00h
mov p1,#0ffh
mov dptr,#DL
mov r6,#31 ;HE SO NHAN
BD: mov r3,#255 ; so cot du lieu
loop: mov r1,#0
loop1:
setb DULIEU ; dua du lieu vao 595
mov r2,#0
lap: mov p1,#0ffh
setb CLK ;tao xung clock vao 595
clr DULIEU
clr CLK
mov a,r2
movc a,@a+dptr
cpl a
mov CHAR,a
mov 7fh,#100 ; cho thoi gian ngan
djnz 7fh,$
inc r2
cjne r2,#33,lap ; so cot led matran
inc r1
cjne r1,#4,loop1 ; toc do chay chu
inc dptr
djnz r3,loop
djnz r6,BD
jmp start
;================================================= ====
DL:
ORG 0100H
DB 0FFH,0FFH,0C0H,0B7H,0B7H,0B7H,0C0H,0FFH ;A
DB 0FFH,0FFH,80H,0B6H,0B6H,0B6H,0C9H,0FFH ;B
DB 0FFH,0FFH,0C1H,0BEH,0BEH,0BEH,0DDH,0FFH ;C
DB 0FFH,0FFH,80H,0BEH,0BEH,0BEH,0C1H,0FFH ;D
DB 0FFH,0FFH,80H,0B6H,0B6H,0B6H,0B6H,0FFH ;E
DB 0FFH,0FFH,80H,0B7H,0B7H,0B7H,0B7H,0FFH ;F
DB 0FFH,0FFH,0C1H,0BEH,0B6H,0B6H,0D1H,0FFH ;G
DB 0FFH,0FFH,80H,0F7H,0F7H,0F7H,80H,0FFH ;H
DB 0FFH,0FFH,0BEH,0BEH,80H,0BEH,0BEH,0FFH ;I
DB 0FFH,0FFH,0BDH,0BEH,0BEH,81H,0BFH,0FFH ;J
DB 0FFH,0FFH,80H,0F7H,0EBH,0DDH,0BEH,0FFH ;K
DB 0FFH,0FFH,80H,0FEH,0FEH,0FEH,0FEH,0FFH ;L
DB 0FFH,0FFH,80H,0DFH,0EFH,0DFH,80H,0FFH ;M
DB 0FFH,0FFH,80H,8FH,0F7H,0F8H,80H,0FFH ;N
DB 0FFH,0FFH,0C1H,0BEH,0BEH,0BEH,0C1H,0FFH ;O
DB 0FFH,0FFH,80H,0BBH,0BBH,0BBH,0C7H,0FFH ;P
DB 0FFH,0FFH,0C1H,0BEH,0BAH,0BCH,0C1H,0FFH ;Q
DB 0FFH,0FFH,80H,0B7H,0B3H,0B5H,0CEH,0FFH ;R
DB 0FFH,0FFH,0DDH,0AEH,0B6H,0BAH,0DDH,0FFH ;S
DB 0FFH,0FFH,0BFH,0BFH,80H,0BFH,0BFH,0FFH ;T
DB 0FFH,0FFH,81H,0FEH,0FEH,0FEH,81H,0FFH ;U
DB 0FFH,0FFH,83H,0FDH,0FEH,0FDH,83H,0FFH ;V
DB 0FFH,0FFH,81H,0FEH,0F1H,0FEH,81H,0FFH ;W
DB 0FFH,0FFH,9CH,0EBH,0F7H,0EBH,9CH,0FFH ;X
DB 0FFH,0FFH,9FH,0EFH,0F0H,0EFH,9FH,0FFH ;Y
DB 0FFH,0FFH,0BCH,0BAH,0B6H,0AEH,9EH,0FFH ;Z
END.
DULIEU BIT P3.0
CLK BIT P3.1
CHAR EQU P1
org 0000h
start:
mov a,#00h
mov p1,#0ffh
mov dptr,#DL
mov r6,#31 ;HE SO NHAN
BD: mov r3,#255 ; so cot du lieu
loop: mov r1,#0
loop1:
setb DULIEU ; dua du lieu vao 595
mov r2,#0
lap: mov p1,#0ffh
setb CLK ;tao xung clock vao 595
clr DULIEU
clr CLK
mov a,r2
movc a,@a+dptr
cpl a
mov CHAR,a
mov 7fh,#100 ; cho thoi gian ngan
djnz 7fh,$
inc r2
cjne r2,#33,lap ; so cot led matran
inc r1
cjne r1,#4,loop1 ; toc do chay chu
inc dptr
djnz r3,loop
djnz r6,BD
jmp start
;================================================= ====
DL:
ORG 0100H
DB 0FFH,0FFH,0C0H,0B7H,0B7H,0B7H,0C0H,0FFH ;A
DB 0FFH,0FFH,80H,0B6H,0B6H,0B6H,0C9H,0FFH ;B
DB 0FFH,0FFH,0C1H,0BEH,0BEH,0BE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