5.30.2007

实验五 七段数码管

实验内容:编程实现在两个数码管上循环显示00~99.

data segment

LEDtb db 3fh, 06h, 5bh, 4fh, 66h, 6dh, 7dh, 07h, 7fh, 6fh

data ends

code segment

assume cs:code,ds:data

START:

mov ax,data

mov ds,ax

mov dx, 28bh

mov al, 80h

out dx, al

mov dx, 288h

next:

mov ax, 00h

push ax

again:

pop ax ;恢复计数

cmp ax, 100

jz next

push ax ;保存计数

mov cl, 10

div cl

push ax ;保存余数和商 AX

xlat

out dx, al

push dx ;保存A口地址288h

mov dx, 28ah

mov al, 02h

out dx, al

call delay

pop dx ;恢复A口地址288H

pop ax ;恢复余数和商 AX

;输出个位数

mov al, ah

xlat

out dx, al

mov al, 01h

push dx ;保存A口地址288H

mov dx, 28ah

out dx, al

call delay

pop dx ;恢复A口地址288H

pop ax ;恢复计数 AX

add ax, 1

push ax ;保存计数

mov ah, 01h

int 16h

jz again

 

MOV AH, 4CH ;主程序结束

INT 21H

 

Delay proc

push cx

xor cx, cx

again1:

loop again1

pop cx

ret

Delay endp

CODE ENDS

END START

0 Comments: