⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 led.asm

📁 用89s51做的车辆引导系统,在狭小的长距离单通道时避免会车
💻 ASM
字号:
one equ r1
two equ r2
three equ r3
onebus bit b.1
twobus bit b.2
threebus bit b.3
onelight bit p1.0		;第一口红绿灯
twolight bit p1.3		;第二口红绿灯
threelight bit p1.6		;第三口送绿灯

onein equ p3.3			;第一口入口地感
twoin equ p3.4			;第二入口地感
threein equ p3.5		;第三口入口地感
org 0000h
jmp ok
org 000bh
jmp delay5minadd

org 0040h
ok : 
	mov tmod ,#00000001b
	mov tcon ,#0
	setb ea
	setb et0
	mov th0 ,#28h
	mov tl0 ,#0h
	mov one,#0
	mov two,#0
	mov three,#0
	
	mov p3 ,#0ffh
	setb onelight
	setb twolight
	setb threelight
	
start : 
	jnb onein ,oneine
;	jnb oneout ,oneoute
	jnb twoin ,twoine
;	jnb twoout ,twooute
	jnb threein ,threeine
;	jnb threeout ,o1
	jmp start
o1 :	jmp threeoute

oneine :
	call delay
	jb onein ,start
	jb twobus ,oneoute
	jb threebus ,oneoute
	inc one
	setb onebus
	clr twobus
	clr threebus
	setb onelight
	clr twolight
	clr threelight
	jnb onein ,$
	call delay
	call delay5min
	jmp start
oneoute :
	call delay
;	jb oneout ,start
	call jisu
	jnb onein ,$
	call delay
	jmp start
twoine :
	call delay
	jb twoin ,start
	jb onebus ,twooute
	jb threebus ,twooute
	inc two
	setb twobus
	clr onebus
	clr threebus
	setb twolight
	clr onelight
	clr threelight
	jnb twoin ,$
	call delay
	call delay5min
	jmp start
twooute :
	call delay
;	jb twoout ,start
	call jisu
	jnb twoin ,$
	call delay
	jmp start
threeine :
	call delay
	jb threein ,o
	jb onebus ,threeoute
	jb twobus ,threeoute
	inc three
	setb threebus
	clr onebus
	clr twobus
	setb threelight
	clr onelight
	clr twolight
	jnb threein ,$
	call delay
	call delay5min
	jmp start
threeoute :
	call delay
;	jb threeout ,o
	call jisu
	jnb threein ,$
	call delay
o:	jmp start
delay:	mov r5,#50	
d1: 	mov r6,#40
d2:	mov r7,#20
	djnz r7,$
	djnz r6,d2
	djnz r5,d1
	ret

oneing : 
rete : jmp start 
jisu :
		jb twobus ,twobuse
		jb threebus ,threebuse
		dec one
		mov a ,one
		jz zero
		ret
twobuse : 
	dec two
	mov a ,two
	jz zero
	ret
threebuse : 
	dec three
	mov a,three
	jz zero
	ret
zero: setb onelight
	setb twolight
	setb threelight
	clr onebus
	clr twobus
	clr threebus
	clr tr0
	ret
delay5min :
	setb ea
	setb et0
	mov th0 ,#28h
	mov tl0 ,#0h
	mov 40h ,#50
	mov 41h ,#100
	
	setb tr0
	ret
delay5minzero :
	clr tr0
	mov th0 ,#28h
	mov tl0 ,#0h
	mov 40h ,#50
	mov 41h ,#100
	call zero
	ret
delay5minadd :
	push acc
	push psw
	mov th0 ,#28h
	mov tl0 ,#0h
	
	djnz 40h ,d8
	djnz 41h ,d9
	mov 40h ,#50
	mov 41h ,#100
	call delay5minzero
	d9 :mov 40h ,#50
d8:	pop psw
	pop acc
	reti
end	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -