单片机多功能人体秤设计 第12页
MOVX A,@DPTR
ANL A,80H
JNZ RDS12887
MOV DPTR,#2000H;将秒数据放到T-SEC
MOVX A,@DPTR
MOV T-SEC,A
MOV DPTR,#2002H;将分数据放到T-MIN
MOV A,@DPTR
MOV T-MIN,A
MOV DPTR,2004H;将时数据放到T-HOUR
MOV A,@DPTR
MOV T-HOUR,A
MOV DPTR,2007H;将日数据放到T-DAY
MOV A,@DPTR
MOV T-DAY,A
MOV DPTR,2008H;将月数据放到T-MON
MOV A,@DPTR
RET
ZL:MOV A,#4000H;启动A/D转换
MOVX @DPTR,A ;
HERE:AJMP HERE ;等待中断
INTO:PUSH PSW ;保护现场
PUSH ACC
MOV DPTR,#6000H;读取数据并放到缓冲区
MOV A,@DPTR
MOV @R0,A
INC R0 ;R0自加1
DJNZ R1,LOOP ;判断中断产生次数是否够五次,够的话顺序执不够的话跳转
MOV R0,#43H
MOV A,@R0
MOV B,#05H
SUB A,B
JC INT0-LOOP;判断个位是否大于五,大于5跳转,不大于顺序执行
CLR 43H ;将43H地址内容清零
INTO-LOOP:MOV A,#05H;大于5的话置43H地址为05H
MOV R0,#43H
MOV @R0,A
MOV R0,#42H;将百位上加08H显示时带小数点
MOV A,@R0
ADD A,#08H
MOV @R0,A
LOOP: RETI;中断返回
SG:SETB P1.7;使L297工作
SETB P1.6;控制步进电机正转
LOOP:SETB P1.5;发送脉冲
LCALL DELAY1MS
MOV 73H,#00H;计脉冲数
MOV A,#73H
ADDC A,#01H
MOV 73H,A
CLR P1.5
LCALL DELAY1MS
JB P1.4,LOOP;压头板是否到头部,不到跳转,否则顺序执行
SEVEN:MOV TIME,#07H;脉冲数乘以0.7的压头板下降距离
MOV A,73H
MOV 75H,A
MOV A,74H
MOV 76H,A
MOV A,73H
ADDC A,75H
MOV 75H,A
MOV A,74H
ADDC A,76H
MOV 76H,A
DJNZ TIME,SEVEN
MOV TIME,#0A0H
TE: MOV A,75H
SUBB A,73H
MOV 75H,A
MOV A,76H
SUBB A,74H
MOV 76H,A
www.751com.cn SUBB A,75H
MOV 77H,A
MOV A,78H
SUBB A,76H
MOV 78H,A
MOV A,#03H;将身高数据转化成BCD码送缓冲区
MOV 7AH,A
MOV A,#0E8H
MOV 79H,A
MOV A,#64H
MOV 7BH,A
MOV A,#0AH
MOV 7CH,A
MOV A,#00H
ORL A,78H
JNZ BAI
QIAN: MOV A,78H;转化千位BCD码
SUBB A,7AH
MOV 78H,A
JC QIAN1
MOV 40H,TIME3
BAI: MOV A,77H;转化百位BCD码
SUBB A,7BH
MOV 77H,A
JC BAI1
MOV 41H,TIME1
SHI: MOV A,77H;转化十位BCD码
SUBB A,7CH
MOV 77H,A
JC SHI1
MOV 42H,TIME2
LOOP1:CLR P1.6;控制步进电机反转
SETB P1.5;发送脉冲
LCALL DELAY1MS
CLR P1.5
LCALL DELAY1MS
MOV A,73H;脉冲数减一
SUBB A,#01H
MOV 73H,A
JNZ LOOP1;73H是否为0,为0顺序执行,否则跳转
MOV A,74H
JNZ LOOP1;74H是否为0,为0顺序执行,否则跳转
CLR P1.7;使L297停止工作
LJMP $
QIAN1: INC TIME3
<< 上一页 [11] [12] [13] 下一页
单片机多功能人体秤设计 第12页下载如图片无法显示或论文不完整,请联系qq752018766