您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > 述职报告 > 温度采集控制汇编程序
;--------------------------------------------------------------;设定地址;--------------------------------------------------------------AD0809IN0EQU0CFA0HDA0832EQU0CFA8HCON8279EQU0CFE9HDATA8279EQU0CFE8H;---------------------------------------------------------------------------;起始阈值;---------------------------------------------------------------------------ORG0000HLJMPMAINORG4100HMAIN:MOVR5,#30H;设置起始阈值MOVDPTR,#CON8279;8279命令口地址MOVA,#0D1H;清除8279RAM命令MOVX@DPTR,AWAIT:MOVXA,@DPTR;判断JBACC.7,WAIT;等待清除完成,DU=0;--------------------------------------------------------------------------------------;采集电压转化为数字量;---------------------------------------------------------------------------------------START:MOVDPTR,#AD0809IN0;采样MOVA,#00H;启动A/DMOVX@DPTR,AMOVR7,#0FFHLOOP1:DJNZR7,LOOP1;延时等待AD转换完成MOVXA,@DPTRMOVR6,A;保存温度值TRANS:MOVA,R6;温度转换CLRCSUBBA,#53H;计算偏移地址-10度LCALLTAB;取伪温度植MOVR6,A;---------------------------------------------------------------------------------;温度显示;---------------------------------------------------------------------------------LED1:MOVA,R6;显示当前温度SWAPA;高低字节交换ANLA,#0FHMOV50H,AMOVA,R6ANLA,#0FHMOV51H,ALOOP:MOVDPTR,#CON8279MOVA,#90HMOVX@DPTR,AMOVR0,#50HMOVR1,#02HMOVDPTR,#DATA8279DL0:MOVA,@R0ACALLTABLEMOVX@DPTR,AINCR0DJNZR1,DL0LCALLDEL1;显示完温度;------------------------------------------------------------------------------------;按键检测;------------------------------------------------------------------------------------MOVDPTR,#CON8279;检查是否有键按下MOVXA,@DPTRANLA,#0FHJZFUN2;无键按下MOVA,#0A0H;有键按下MOVX@DPTR,AMOVA,#40H;40H读RAMMOVX@DPTR,AMOVDPTR,#DATA8279MOVXA,@DPTRMOVR4,ACJNEA,#0C0H,FUN1INCR5;阈值加一CJNER5,#1AH,DJUST1;矫正1A为20MOVR5,#20HDJUST1:CJNER5,#2AH,FUN2;矫正2A为30MOVR5,#30HLJMPFUN2FUN1:CJNEA,#0C1H,FUN2DECR5CJNER5,#2FH,DJUST2;矫正2F为29MOVR5,#29HDJUST2:CJNER5,#1FH,FUN2;矫正1F为19MOVR5,#19HLJMPFUN2;-------------------------------------------------------------------------------;比较阈值,改变转速;-----------------------------------------------------------------------------------FUN2:MOVA,R6;取温度。比较阈值MOV54H,R5SUBBA,54HJCFUN4;c=1小于阈值FANS1:MOVR7,#00H;快转MOVA,R7LCALLDAZHLJMPLED2FUN4:MOVR7,#0FFH;慢转MOVA,R7LCALLDAZHLED2:MOVA,R5;显示阈值SWAPAANLA,#0FHMOV52H,AMOVA,R5ANLA,#0FHMOV53H,ALOOP2:MOVDPTR,#CON8279MOVA,#94HMOVX@DPTR,AMOVR0,#52HMOVR1,#02HMOVDPTR,#DATA8279DL1:MOVA,@R0ACALLTABLEMOVX@DPTR,AINCR0DJNZR1,DL1;阈值显示完毕LCALLDEL1稳定LJMPSTART;重新开始;--------------------------------------------------------------------------------;延时函数;--------------------------------------------------------------------------------DEL1:MOVR2,#80HDEL2:MOVR3,#0FFHDEL3:DJNZR3,DEL3DJNZR2,DEL2RET;---------------------------------------------------------------------------------------;数摸转换;---------------------------------------------------------------------------------------DAZH:MOVDPTR,#DA0832MOVX@DPTR,A;写DA输入寄存器INCDPTR;指向DAC寄存器MOVX@DPTR,A;启动转换RET;--------------------------------------------------------------------------------------;断码表;--------------------------------------------------------------------------------------TABLE:INCA;数码管显码转换MOVCA,@A+PCRETDB3FH,06H,5BH,4FH,66H,6DH,7DH,07HDB7FH,6FH,77H,7CH,39H,5EH,79H,71H,00HTAB:INCA;温度转换MOVCA,@A+PCRETDB10H,10H,10H,11H,11H,12H,12H,13H,13HDB13H,14H,14H,15H,15H,15H,16H,16H,16HDB17H,17H,17H,18H,18H,18H,19H,19H,19H,DB19H,19H,20H,20H,20H,21H,21H,21H,21HDB22H,22H,23H,23H,23H,24H,24H,24H,25HDB25H,25H,26H,26H,26H,27H,27H,27H,28HDB28H,28H,29H,29H,29H,30H,30H,30H,31HDB31H,31H,32H,32H,32H,33H,33H,33H,34HDB34H,34H,35H,35H,35H,36H,36H,36H,37HDB37H,37H,38H,38H,38H,39H,39H,39H,40HDB40H,40HEND
本文标题:温度采集控制汇编程序
链接地址:https://www.777doc.com/doc-4980342 .html