南京工程学院毕业设计说明书(论文)
ldi r16,$fe
rcall wbyte sbi portd,scs
ldi r16,$0b ;读配置寄存器(1) rcall rreg
ldi r20,$20 ;置配置寄存器\ clr r19 clr clr ldi rcall
rv1: ldi rcall sbrs rjmp
ldi clr clr clr ldi rcall
ldi ldi ldi ldi ldi rcall
ldi ldi ldi ldi ldi rcall
ldi cbi rcall ad00: sbic r18 r17 r16,$03
wreg r16,$0b rreg r20,4
rv1 r20,$02 r19 r18 r17 r16,$03 wreg
r20,$22 r19,$00 r18,$22 r17,$00 r16,$05 wreg
r20,$42 r19,$40 r18,$42 r17,$40 r16,$15 wreg
r16,$81 portd,scs wbyte
pinb,sdo ;读配置寄存器\;OK,跳转
;设置配置寄存器(1) ;设置0通道设置寄存器(1)
;增益=16,采样速率=7.5次,双极性 ;设置1通道设置寄存器(1)
;增益=1,采样速率=7.5次,单极性 ;启动0通道转换自偏移校验 ;A/D转换是否结束?
41
南京工程学院毕业设计说明书(论文)
rjmp ad00 ;NO,等待转换结束 sbi portd,scs
ldi r16,$82 ;启动0通道转换自增益校验 cbi portd,scs
rcall wbyte
ad01: sbic pinb,sdo ;A/D转换是否结束? rjmp ad01 ;NO,等待转换结束 sbi portd,scs
ldi r16,$91 ;启动1通道转换自偏移校验 cbi portd,scs
rcall wbyte
ad10: sbic pinb,sdo ;A/D转换是否结束? rjmp ad10 ;NO,等待转换结束 sbi portd,scs
ldi r16,$92 ;启动1通道转换自增益校验 cbi portd,scs
rcall wbyte
ad11: sbic pinb,sdo ;A/D转换是否结束? rjmp ad11 ;NO,等待转换结束 sbi portd,scs ; set ; ; ; ; ; ; ; ; ; ; ; ; ; ;
sei
ad000: ldi r16,$80
bld r2,4 bld r2,5 ldi r26,$54 ldi r16,$a0 st x+,r16 ldi r16,$86 st x+,r16 ldi r16,$01 st x+,r16 inc r26 clr r16 st st st
x+,r16 x+,r16 x+,r16
;“k\系数=1
;偏移量=0
;启动0通道正常转换(压力)
42
南京工程学院毕业设计说明书(论文)
cbi portd,scs
Rcall wbyte
ad02: sbic pinb,sdo ;A/D转换是否结束? rjmp ad02 ;no,等待
cli
ldi r16,$00 ;A/D转换结束,继续
rcall wbyte
rcall rbyte ;采集数据(存R20,R19,R18,R17) mov r22,r16 rcall rbyte mov r21,r16 rcall rbyte mov r20,r16 rcall rbyte mov r19,r16 sbi portd,scs
ad100: ldi r16,$90 cbi portd,scs
rcall wbyte
sei
rcall yiwei ldi r26,$6b st x+,r20 st
x+,r21
st x+,r22
mov r16,r20 mov r17,r21 mov r18,r22
rcall xxx
;求“x“
ad12: sbic pinb,sdo rjmp ad12 cli
ldi r16,$00 rcall wbyte
rcall rbyte mov r22,r16 rcall rbyte mov r21,r16
;启动1通道正常转换(温度)
;保存压力采集数
;A/D转换是否结束? ;no,等待
;A/D转换结束,继续
;采集数据(存R20,R19,R18,R17) 43
南京工程学院毕业设计说明书(论文)
rcall rbyte mov r20,r16 rcall rbyte mov r19,r16 sbi portd,scs
ldi r16,$80
cbi portd, scs rcall wbyte sei
x+,r21 x+,r22
;保存温度采集数
;启动0通道正常转换(压力)
st st
mov r16,r21 mov r17,r22 rcall yyy
chuli: rcall lin
;求”y“
;压力线性化
;乘“K”系数
mov r13,r20 mov r14,r21 mov r15,r22 ldi r26,$44 ld r16,x+ ld r17,x+ ld r18,x+ rcall mm33 ldi r16,$a0 mov r14,r16 ldi r16,$86 mov r15,r16 ldi r16,$01 Clr r17 clr r18 clr r19
rcall dd48
ldi r26,$48 ;加上偏移量 ld r13,x+ ld r14,x+ ld r15,x+ add r20,r13
44