📄 电梯实验程序.txt
字号:
org 0000h
ajmp start
org 0040h
start:
a_m equ 20h
b_m equ 21h
a_h equ 23h
b_h equ 24h
temp equ 25h
temp2 equ 26h
s_bit equ 27h
temp01 equ 28h//定时分钟
temp21 equ 29h//定时小时
mov s_bit,#0ffh
mov temp,#0
mov temp2,#0
mov temp01,#0
mov temp21,#0
mov r4,#0//关定时开关
mov 32h,#0
mov 33h,#0
mov 30h,#0
mov 31h,#0
mov r0,#0
mov r1,#0
mov p3,#0ffh
csh8: jb p1.0, next
acall d10ms
jb p1.0, next
ajmp next2
next: jb p1.3,zmhs
clr p1.5
mov temp, #08h
ajmp csh8
zmhs: setb p1.5
ajmp csh8
next2: setb p1.5
mov temp, #01h //到这里通电初始化完成,停在一楼
stlop: acall disply
jb p1.3, cm //查门
ajmp jx
cm: acall cmc
jx: jb p3.3, th
lcall d10ms
jb p3.3, th //查一楼按扭有没按下
jnb p1.0, th //查是否停在一楼
acall csh //查到不在一楼就调用下降子程序
th: jb p3.4,th2
lcall d10ms
jb p3.4, th2
jnb p1.1, th2
acall csh2
th2:
jb p3.5, th3
lcall d10ms
jb p3.5, th3
jnb p1.2, th3
acall csh3
th3: nop
ljmp stlop //主程序到这里完了
cmc: push temp
mov a,temp
add a,#46h
mov temp,a
cm2: acall disply
jb p1.3, cm2
pop temp
ret
cshh: mov temp, #4Eh
setb p1.5
csh: acall disply
jb p1.0, next00
acall d10ms
jb p1.0, next00
ajmp next02
next00: jb p1.3, cshh
jb p1.2, csdj
mov temp, #26h
csdj: jb p1.1, csdj2
mov temp, #1Ch
csdj2: clr p1.5
jb p1.3,csh //加一次查门
ajmp csh
next02: setb p1.5
acall d1ms
mov temp, #01h
ret
d1ms: mov r7,#10
d1: mov r6, #200
d2: djnz r7, d1
ret
csh222: mov temp, #4Dh
csh2: setb p1.5
acall d1ms
setb p1.6
acall disply
jb p1.1,next3
acall d10ms
jb p1.1,next3
ajmp next4
next3: jb p1.3, csh222
jb p1.0,next43
acall d10ms
jb p1.0,next43
clr p1.6
mov temp, #09h
acall sg
ajmp next4
next43: jb p1.3, csh222
jb p1.2,next4
acall d10ms
jb p1.2,next4
clr p1.5
mov temp, #08h
acall xj
ajmp next4
next4:
ret
cshh3: mov temp, #4Fh
setb p1.6
csh3: acall disply
jb p1.2, next7
acall d10ms
jb p1.2, next7
ajmp next8
next7: jb p1.3, cshh3
jb p1.0, csdj3
mov temp, #13h
csdj3: jb p1.1, csdj23
mov temp, #1dh
csdj23: clr p1.6
jb p1.3,csh3 //加一次查门
ajmp csh3
next8: setb p1.6
mov temp, #03h
ret
csh22: jb p1.1,next23
acall d10ms
jb p1.1,next23
ajmp next4
next23: jb p1.3, csh22
jb p1.2,next24
acall d10ms
jb p1.2,next24
clr p1.5
mov temp, #08h
acall xj
ajmp next24
next24:
ret
d10ms: mov r7, #200
d3: mov r6, #200
d4: djnz r6, $
djnz r7, d3
ret
sgg: mov temp, #4Fh
setb p1.6
sg: acall disply
jb p1.1,next32
acall d10ms
jb p1.1,next32
acall d1ms
ajmp out
next32:jb p1.3, sgg
clr p1.6
mov temp, #13h
ajmp sg
out: setb p1.6
mov temp, #02h
ret
xjj: mov temp, #4Eh
setb p1.5
xj: acall disply
jb p1.1,next33
acall d10ms
jb p1.1,next33
acall d1ms
ajmp out2
next33: jb p1.3, xjj
clr p1.5
mov temp, #26h
ajmp xj
out2: setb p1.5
mov temp, #02h
ret
disply:mov a,temp
mov b,#10
div ab
mov b_m,a
mov a_m,b
mov dptr,#nemtab
dplop:mov a,a_m
movc a,@a+dptr
mov p0,a//送显示
clr p2.2
acall d1ms
setb p2.2
mov a,b_m
movc a,@a+dptr
mov p0,a
clr p2.3
acall d1ms
setb p2.3
ret
time0:
push acc
push psw
reti
nemtab:db 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0C9H,81H,88H
end
/*p1.0=一楼平层开关,p1.1=二楼平层开关,p1.2=三楼平层开关.p1.3=门检开关.p1.5下降,p1.6上升.p3.3一楼按扭
p3.4二楼按扭,p3.5三/楼按扭.每个楼层平层之后都会有显示.上升显示0A.
下降显示0倒A.运行过程中打开门,自动停车,并显示11A.2007年10月27日晚完
成调试*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -