用51單片機模擬空調(diào)遙控開關(guān)-匯編程序 作者: 時間:2016-11-29 來源:網(wǎng)絡 加入技術(shù)交流群 掃碼加入和技術(shù)大咖面對面交流海量資料庫查詢 收藏 CJNE A,SET0,E11clr beepclr p3.0LCALL DELAY2MS380USLCALL DELAY2MS380USLCALL DELAY2MS380USsetb p3.0setb beepRETE11:CJNE A,SET1,E12clr beepclr p3.1LCALL DELAY2MS380USLCALL DELAY2MS380USLCALL DELAY2MS380USsetb p3.1setb beepretE12:CJNE A,SET2,E13clr beepclr p3.2LCALL DELAY2MS380USLCALL DELAY2MS380USLCALL DELAY2MS380USsetb p3.2setb beepRETE13:CJNE A,SET3,E14clr beepclr p3.4LCALL DELAY2MS380USLCALL DELAY2MS380USLCALL DELAY2MS380USsetb p3.4setb beepRETE14:;RET;--------延時------DELAY2MS380US: ;1T 11.0592MMOV R6,#0DFHDL0:MOV R5,#1CHDJNZ R5,$DJNZ R6,DL0RETDELAY1MS: ;1T 11.0592MMOV R6,#12HDL05:MOV R5,#98HDJNZ R5,$DJNZ R6,DL05NOPRETDELAY255MS: ;MOV R7,#255DL045:call DELAY1MSDJNZ R7,DL045NOPRETDELAY2S: ;MOV R4,#7DL1s:call DELAY255MSDJNZ R4,DL1sRET;************************ERASE:;擦除MOV IAP_CONTR,#83h;允許IAP/IAP操作MOV IAP_CMD,#03H ;扇區(qū)擦除MOV IAP_ADDRH,DPH ;送高地址MOV IAP_ADDRL,DPL ;送低地址ACALL IAPXX ;觸發(fā)RET;************************EEPROMW:;寫MOV IAP_CONTR,#83h;允許IAP/IAP操作MOV IAP_CMD,#02H ;送寫命令MOV IAP_ADDRH,DPH ;送高地址MOV IAP_ADDRL,DPL ;送低地址MOV IAP_DATA,A ;A是要寫入的數(shù)據(jù)ACALL IAPXX ;觸發(fā)RET;************************EEPROMR:;讀MOV IAP_CONTR,#83h;允許IAP/IAP操作MOV IAP_CMD,#01H ;送讀命令MOV IAP_ADDRH,DPH ;送高地址MOV IAP_ADDRL,DPL ;送低地址ACALL IAPXX ;觸發(fā)MOV A,IAP_DATA ;讀出的數(shù)據(jù)放到ARET;----------IAPXX:;觸發(fā)MOV IAP_TRIG, #5AHMOV IAP_TRIG, #0A5H ;NOPNOPret;---------------------IAP_Disable:;禁止IAP/IAP操作MOV IAP_CONTR,#0 MOV IAP_CMD,#0 MOV IAP_TRIG,#0 MOV IAP_ADDRH,#0FFHMOV IAP_ADDRL,#0FFHRETbao0:MOV DPTR, #0;保存call ERASEmov a,30hcall EEPROMWinc dptrmov a,31hcall EEPROMWinc dptrmov a,32hcall EEPROMWinc dptrmov a,33hcall EEPROMWcall IAP_Disableretbao1:MOV DPTR,#200h;保存call ERASEMOV A,MA2mov 2fh,acall EEPROMWcall IAP_DisableretEND 上一頁 1 2 下一頁
評論