南京工程学院毕业设计说明书(论文)
;
adc r21,r14 adc r22,r15 ldi r26,$62 st st st
x+,r20 x+,r21 x+,r22
;保存压力值
rjmp ppp
ldi r26,$3e
;有否RS-232命令?
ld r16,x cpi r16,$50 ;是否单次发送命令? brne qqq clr r16 ;清单次命令
;准备发送压力
st x,r16 ppp: ldi r26,$10
rcall bcd ldi r26,$10 ldi r28,$20 ldi r17,3
ldi r18,$30 ppp1: ld r16,x+ cpi r16,0 brne ppp2
ldi r16,$20 st y+,r16 dec r17 brne ppp1 rjmp ppp3
add r16,r18 y+,r16
ppp2: st
ld r16,x+ dec r17
brne ppp2
ppp3: ldi r26,$13
ld r16,x+ add r16,r18 st y+,r16 ldi r16,$2e st
y+,r16 ld r16,x+ add r16,r18 st y+,r16
45
;\
南京工程学院毕业设计说明书(论文)
ld r16,x+ add st ldi st
r16,r18 y+,r16 r16,$0d y+,r16
rcall fasong rjmp ad02
;是否连续发送命令?
qqq: cpi r16,$51 sss:
brne sss
rjmp ppp
cpi r16,$53 ;是否“S”命令? brne k_0 clr r16 ;清单次命令 st x,r16 ldi r30,$60 ldi r31,$0e ldi r26,$20 ldi r25,13 call dushu
;读传感器系列号
rcall fasong rjmp ad02
k_0: cpi r16,$58
brne yali clr r16
;是否发送参数命令?
;清单次命令
;\
st x,r16 ldi r26,$44 ld r20,x+ ld r21,x+ ld r22,x+ ldi r26,$10 rcall bcd ldi r26,$10 ldi r28,$20 ldi r18,$30 ld r16,x+ add r16,r18 st
y+,r16 ldi r16,$2e st y+,r16 ldi r17,5
;\
46
南京工程学院毕业设计说明书(论文)
k_01: ld r16,x+ add r16,r18 st y+,r16 dec r17 brne k_01 ldi r16,$20 st
y+,r16
;\
ldi r26,$48 ;\
ld r20,x+ ld r21,x+
ld r22,x+ ldi r26,$10 rcall bcd ldi r26,$10
ldi r17,3
ldi r18,$30 k_02: ld r16,x+ cpi r16,0 brne k_03 ldi r16,$20 st y+,r16 dec r17 brne k_02
rjmp k_04
k_03: add r16,r18 st y+,r16
ld r16,x+ dec r17
brne k_03
k_04: ldi r26,$13 ld r16,x+ add r16,r18 st y+,r16 ldi r16,$2e st y+,r16 ld r16,x+ add r16,r18 st y+,r16 ld r16,x+ add r16,r18 st y+,r16 ldi r16,$0d
st y+,r16
47
;\
南京工程学院毕业设计说明书(论文)
rcall fasong rjmp ad02
yali: sbrs r2,7 ;显示\
rjmp dmmhg
rcall kpa
rjmp jgaodu dmmhg: sbrs r2,6 ;显示\
rjmp dpsi
rcall mmhg rjmp jgaodu dpsi: sbrs r2,5 ;显示\
rjmp dhpa
rcall psi
rjmp jgaodu dhpa: rcall hpa ;显示\
jgaodu: rcall gaodu
;保存当前高度 ldi r26,$65 st x+,r13 st
x+,r14
st x+,r15
mov r20,r13 ;显示高度
mov r21,r14
mov r22,r15
sbrs r2,3 ;是否计算相对高度? rjmp h
ld r16,x+ ld r17,x+ ld r18,x+ ldi r19,$80 add r18,r19 add r22,r19 sub r20,r16
sbc r21,r17
sbc r22,r18
h: sbrs r2,4 ;是否计算“ft”?
rjmp m rcall ft m: rcall bcdh
48