資源描述:
《單片機溫度檢測系統(tǒng)的匯編實現(xiàn)(compilation of temperature detection system for single chip microcomputer)》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、單片機溫度檢測系統(tǒng)的匯編實現(xiàn)(Compilationoftemperaturedetectionsystemforsinglechipmicrocomputer)Digitalthermometerassemblylanguagesourcecodeisasfollows:******************************temperaturevalue*****************storageunit;TEMP_ZHEQU24H;realtimetemperaturevaluestorageunitTEMPLEQU25H;l
2、owtemperaturevaluestorageunitTEMPHEQU26H;hightemperaturevaluestorageunitTEMP_THEQU27H;hightemperaturealarmvaluestorageunitTEMP_TLEQU28H;lowtemperaturealarmvaluestorageunitTEMPHCEQU29H;keeptendigitBCDcodesTEMPLC,EQU,2AH;BCDcodesforindividualbits****************************;k
3、eyinputpindefinition******************K1EQUP1.0K2EQUP1.1K3EQUP1.2K4EQUP1.3SPKEQUP3.7;buzzerZFEQU22H.1XEQU2FH;setsthedisplayposition****************************LCDcontrol*************************pin;RSEQUP2.0RWEQUP2.1EEQUP2.2FLAGEQU21H.0;temperaturesensorflagbitKEY_UDEQU21H.
4、1DQEQUP3.3;temperaturesensordataacquisitionportThemainprogram***********************************************************;ORG0000HLJMPMAINORG0023HORG0030HMAIN:,MOV,SP,#5FHMOVTMOD,#20H;thetimerT1isthe2(autoreload8bitcounter)MOV,TH1,#0F3H;setthetimerinitialvalue,MOV,TL1,#0F3HS
5、ETBTR1;timerstartMOV,TEMP_TH,#27MOV,TEMP_TL,#20ACALLSET_LCD;LCDinitializationsettingsubroutineTOOP:ACALLRESET_1820;callthe18B20resetsubroutineJNB,FLAG,TOOP1;DS1820doesnotexist,thenjumpACALLXS_S;callthe"SUCCES"informationsubroutineACALLWR_THL;writesthealarmupperandlowerlimit
6、stothescratchpadregistersubroutineACALLRE_THL;copiesthetemperaturealarmvaluesintheE2ROMbacktotheregistersJMPTOOP2TOOP1:ACALLXS_WRONG;displays"WRONG"informationSJMPTOOP;returns,continuestojudgeTOOP2:ACALLRE_TEMP;callreadtemperaturedatasubroutineACALLSET_DATA;callprocessingto
7、displaytemperaturedatasubprogramACALLTEMP_COMP;theactualtemperaturevalueiscomparedwiththemarkedtemperaturevaluesubroutineACALLP_KEY;callkeyscansubroutineJMPTOOP2;loop****************************;;readthetemperaturedata**************************subroutineRE_TEMP:JNB,FLAG,TOO
8、P1;determinewhetherDS18B20existsACALLRESET_1820;18B20resetsubroutineMOV,A,#0CCH;sk