Mình đang làm đồ án môn vi xử lý 8086 đề tài: Chạy dòng chữ bất kì trên 8 led matrix đơn,sử dụng IC ghi dịch 74hc595,code viết bằng ngôn ngữ asm,8086 ghép nối 8255a. chủ đề hiển thị trên 8 matrix này em đã thực hiện được đồi với vđk 8051 dùng C. Cũng với thuật toán như vậy nhưng e viết cho vxl 8086 thì có hiện tượng mất nét,sai nét chữ:
đây là dòng chữ A,B,...,H nhưng bị sai nét
e dùng PortA của 8255 để quét cột,các chân 11,12 của các IC 74595 được nối với PB0,PB1,chân SDA nối với PC7
Nhờ mọi người chỉ lỗi sai giúp mình với,mình kém về asm
code:
Thanks!
đây là dòng chữ A,B,...,H nhưng bị sai nét
e dùng PortA của 8255 để quét cột,các chân 11,12 của các IC 74595 được nối với PB0,PB1,chân SDA nối với PC7
Nhờ mọi người chỉ lỗi sai giúp mình với,mình kém về asm
code:
; multi-segment executable file template.
data segment
PA EQU 0h
PB EQU 02h
PC EQU 04h
TG EQU 06h
i dw 0
j dw 0
k dw 0
mang DB 3H,0EDH,0EEH,0EEH,0EEH,0EDH,3H,0FFH ;A
DB 0H,76H,76H,76H,76H,89H,0FFH,0FFH
DB 81H,7EH,7EH,7EH,7EH,0BDH,0FFH,0FFH
DB 0H,7EH,7EH,7EH,7EH,0BDH,0C3H,0FFH
DB 0H,6EH,6EH,6EH,6EH,6EH,0FFH,0FFH
DB 0H,0EEH,0EEH,0EEH,0EEH,0FEH,0FFH,0FFH
DB 81H,7EH,7EH,6EH,6EH,8DH,0EFH,0FFH
DB 0H,0E7H,0E7H,0E7H,0E7H,0H,0FFH,0FFH
DB 7EH,7EH,0H,7EH,7EH,0FFH,0FFH,0FFH
DB 0BEH,7EH,7EH,80H,0FEH,0FEH,0FFH,0FFH ;J
DB 0H,0E7H,0E7H,0DBH,0BDH,7EH,0FFH,0FFH
DB 0H,7FH,7FH,7FH,7FH,7FH,0FFH,0FFH
DB 0H,0FDH,0FBH,0F7H,0FBH,0FDH,0H,0FFH
DB 0H,0F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,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
cot db 01h,02h,04h,08h,10h,20h,40h,80h
ends
stack segment
dw 128 dup(0)
ends
code segment
main proc
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov al,080h
out tg,al
lap4: mov i,0
lap3: ;cmp j,0
;je lap2
mov j,0
cmp i,288
je lap4
add i,1
lap2: cmp k,0
je lap1
mov k,0
add j,1
cmp j,45
je lap3
lap1: mov bx,k
mov al,cot[bx]
out PA,al
mov bx,k
add bx,i
add bx,56
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,48
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,40
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,32
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,24
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,16
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,8
mov al,mang[bx]
call quet
mov bx,i
add bx,k
mov al,mang[bx]
call quet
call chot
call delay
cmp k,7
je lap2
add k,1
jmp lap1
main endp
quet proc
mov cx,8
mov ah,al
quetled: mov al,ah
and al,80h
out PC,al
mov al,ah
shl al,1
mov ah,al
mov al,0h
out PB,al
mov al,01h
out PB,al
loop quetled
ret
quet endp
chot proc
mov al,0
out PB,al
mov al,2
out PB,al
ret
chot endp
delay proc
nop
ret
delay endp
end ; set entry point and stop the assembler.
data segment
PA EQU 0h
PB EQU 02h
PC EQU 04h
TG EQU 06h
i dw 0
j dw 0
k dw 0
mang DB 3H,0EDH,0EEH,0EEH,0EEH,0EDH,3H,0FFH ;A
DB 0H,76H,76H,76H,76H,89H,0FFH,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FH,0FFH,0FFH ;2
DB 0BDH,6EH,6EH,6EH,91H,0FFH,0FFH,0FFH ;3
DB 0CFH,0D7H,0DBH,0DDH,0H,0DFH,0FFH,0FFH ;4
DB 0B0H,76H,76H,76H,8EH,0FFH,0FFH,0FFH ;5
DB 81H,6EH,76H,76H,8DH,0FFH,0FFH,0FFH ;6
DB 0FEH,0FEH,0F6H,0F6H,0H,0F7H,0FFH,0FFH ;7
DB 89H,76H,76H,76H,76H,89H,0FFH,0FFH ;8
DB 0F9H,76H,76H,76H,76H,81H,0FFH,0FFH ;9
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
DB 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
cot db 01h,02h,04h,08h,10h,20h,40h,80h
ends
stack segment
dw 128 dup(0)
ends
code segment
main proc
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov al,080h
out tg,al
lap4: mov i,0
lap3: ;cmp j,0
;je lap2
mov j,0
cmp i,288
je lap4
add i,1
lap2: cmp k,0
je lap1
mov k,0
add j,1
cmp j,45
je lap3
lap1: mov bx,k
mov al,cot[bx]
out PA,al
mov bx,k
add bx,i
add bx,56
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,48
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,40
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,32
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,24
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,16
mov al,mang[bx]
call quet
mov bx,i
add bx,k
add bx,8
mov al,mang[bx]
call quet
mov bx,i
add bx,k
mov al,mang[bx]
call quet
call chot
call delay
cmp k,7
je lap2
add k,1
jmp lap1
main endp
quet proc
mov cx,8
mov ah,al
quetled: mov al,ah
and al,80h
out PC,al
mov al,ah
shl al,1
mov ah,al
mov al,0h
out PB,al
mov al,01h
out PB,al
loop quetled
ret
quet endp
chot proc
mov al,0
out PB,al
mov al,2
out PB,al
ret
chot endp
delay proc
nop
ret
delay endp
end ; set entry point and stop the assembler.