资源描述:
《液晶显示ds18b20温度控制器(程序)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、液晶显示DS18B20温度控制器(程序)液晶显示DS18B20温度控制器(程序)TEMP_ZHDATA24H;实时温度值存放单元TEMPLDATA25H;TEMPHDATA26H;TEMP_THDATA27H;高温报警值存放单元TEMP_TLDATA28H;低温报警值存放单元TEMPHCDATA29H;TEMPLCDATA2AHK1EQUP1.4K2EQUP1.5K3EQUP1.6K4EQUP1.7BEEPEQUP3.7RELAYEQUP1.0LCD_XEQU2FH;LCD地址变量LCD_RSEQUP2.0LCD_RWEQUP2.1LC
2、D_ENEQUP2.2flag1equ20H.0;DS18B20是否存在标记KEY_UDEQU20H.1;设定KEY的UP与DOWN标记date_lineequp3.3;=====================================================ORG0000HJMPMAINMAIN:MOVSP,#60HMOVA,#00HMOVR0,#20H;将20H-2FH单元清零MOVR1,#10HCLEAR:MOV@R0,AINCR0DJNZR1,CLEARCALLSET_LCDCALLRE_18B20start:C
3、ALLRESET;18B20复位子程序JNBFLAG1,START1;DS1820不存在CALLMENU_OKCALLREAD_E2CALLTEMP_BJ;显示温度标记JMPSTART2START1:CALLMENU_ERRORCALLTEMP_BJ;显示温度标记JMP$START2:CALLRESETJNBFLAG1,START1;DS1820不存在MOVA,#0CCH;跳过ROM匹配CALLWRITEMOVA,#44H;发出温度转换命令CALLWRITECALLRESETMOVA,#0CCH;跳过ROM匹配CALLWRITEMOVA
4、,#0BEH;发出读温度命令CALLWRITECALLREADcallCONVTEMPCallDISPBCDCALLCONVCALLTEMP_COMPCALLPROC_KEY;键扫描SJMPSTART2;-----------------------------------------------------PROC_KEY:JBK1,PROC_K1;按键K1处理CALLBEEP_BLJNBK1,$MOVDPTR,#M_ALAX1MOVA,#1CALLLCD_PRINTCALLLOOK_ALARMJBK3,$CALLBEEP_BLJMP
5、PROC_K2PROC_K1:;按键K2处理JBK2,PROC_ENDCALLBEEP_BLJNBK2,$MOVDPTR,#RESET_A1MOVA,#1CALLLCD_PRINTCALLSET_ALARMCALLRE_18B20;将设定的TH,TL值写入DS18B20内CALLWRITE_E2PROC_K2:CALLMENU_OKCALLTEMP_BJPROC_END:RET;============================================;设定报警值TH、TL;========================
6、====================SET_ALARM:;CALLRESET_ALARMCALLLOOK_ALARMAS0:JBK1,AS00CALLBEEP_BLJNBK1,$CPL20H.1;UP/DOWN标记AS00:JB20H.1,ASZ01;20H.1=1,UPJMPASJ01;20H.1=0,DOWNASZ01:JBK2,ASZ02;TH值调整(增加)CALLBEEP_BLINCTEMP_THMOVA,TEMP_THCJNEA,#120,ASZ011MOVTEMP_TH,#0ASZ011:CALLLOOK_ALARMMO
7、VR5,#10CALLDELAYJMPASZ01ASZ02:JBK3,ASZ03;TL值调整(增加)CALLBEEP_BLINCTEMP_TLMOVA,TEMP_TLCJNEA,#99,ASZ021MOVTEMP_TL,#00HASZ021:CALLLOOK_ALARM;MOVR5,#10CALLDELAYJMPASZ02ASZ03:JBK4,AS0;确定调整OKCALLBEEP_BLJNBK4,$RETASJ01:JBK2,ASJ02;TH值调整(减少)CALLBEEP_BLDECTEMP_THMOVA,TEMP_THCJNEA,#0
8、FFH,ASJ011JMPASJ022ASJ011:CALLLOOK_ALARMMOVR5,#10CALLDELAYJMPAS0ASJ02:JBK3,ASJ03;TL值调整(减少)CALLBEEP_BLDE