关于交通灯的程序问题
大家好,我自己编了个关于交通灯的程序效果:
1、LED 左绿灯 右红灯 数码管 从7开始倒计
2、LED 左黄灯闪三下 右红灯
3、LED 左红灯 右绿灯 数码管 从9开始倒计
4、LED 左红灯 右黄灯闪三下
5、循环1
程序
data segment
ioport equ 0a400h-280h
io8255a equ ioport+288h
io8255c equ ioport+28ah
io8255ctr equ ioport+28bh
portc1 db 24h,44h,04h,44h,04h,44h,04h
db 81h,82h,80h,82h,80h,82h,80h
db 0ffh
led db 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh
buffer1 db ?
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov dx,io8255ctr
mov al,80h
out dx,al
re_on:mov bx,0
on: mov al,portc1[bx]
cmp al,0ffh
jz re_on
mov dx,io8255c
out dx,al
inc bx
mov cx,9999
test al,21h
jz de1
push bx
mov di,offset buffer1
cmp al,81h
jz red
green:mov byte ptr[di],7
call loop1
pop bx
jmp on
red: mov byte ptr[di],9
call loop1
pop bx
jmp on
de1: mov di,0f000h
de0: dec di
jnz de0
loop de1
mov ah,1
int 16h
je on
exit: mov ah,4ch
int 21h
loop1 proc
mov cx,0ffffh
loop2: mov bl,[di]
mov bh,0
mov si,offset led
add si,bx
mov al,byte ptr[si]
mov dx,io8255a
out dx,al
push cx
mov cx,05000h
delay: loop delay
pop cx
loop loop2
mov ah,01
int 16h
jne exit1
dec byte ptr[di]
jge loop1
exit1: ret
loop1 endp
code ends
end start
我现在想实现黄灯闪三下时,数码管对应从3开始倒计,要怎么修改?
请跟我联系Email:jackson8634@