超強多功能電子鐘程序 作者: 時間:2016-11-29 來源:網(wǎng)絡(luò) 加入技術(shù)交流群 掃碼加入和技術(shù)大咖面對面交流海量資料庫查詢 收藏 ;*************************************;紅外遙控模塊;*************************************;// 8 192 128 96;//144 184 248 176;//152 216 136 168;//232 72 104 50;// 2 18 32 0;// 64 160 42 178;// 80 120 112 88 ;// 56 40 240 48TELECONTROL:CJNE R5,#1,NOCHLJMP CHINNOCH: DJNZ R5, CHOUT_0CHIN: MOV R4,NO_OUT CJNE R4,#0,CH0CHOUT_0:LJMP CHOUTCH0: ;0 碼型 CJNE R4,#216,CH1MOV A,#0MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH1: ;1 碼型 CJNE R4,#8,CH2MOV A,#1MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH2: ;2碼型 CJNE R4,#192,CH3MOV A,#2MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH3: ;3 碼型 CJNE R4,#128,CH4MOV A,#3MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH4: ;4 碼型 CJNE R4,#96,CH5MOV A,#4MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH5: ;5 碼型 CJNE R4,#144,CH6MOV A,#5MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH6: ;6 碼型 CJNE R4,#184,CH7MOV A,#6MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH7: ;7 碼型 CJNE R4,#248,CH8MOV A,#7MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH8: ;8 碼型 CJNE R4,#176,CH9MOV A,#8MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CH9: ;9 碼型 CJNE R4,#152,CHKEYAMOV A,#9MOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP KEY_0CHKEYA: ;A 碼型 CJNE R4,#136,CHKEYBMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP TIMECHKEYB: ;B 碼型 CJNE R4,#168,CHSAVEMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP STOPWATCHCHSAVE: ;C 碼型 CJNE R4,#232,CHDISMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP SAVE_T_SCHDIS: ;D 碼型 CJNE R4,#72,CHCHNMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP DISPLAY_T_SCHCHN: ;E 碼型 CJNE R4,#104,CHCLRMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP CHANGE_DISCHCLR: ;F 碼型 CJNE R4,#50,CHINTMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP CLEARCHINT: ;G 碼型 CJNE R4,#2, CHACK ;ALARM CLOCKMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0CLR P3.2SETB P3.2CHACK:CJNE R4,#18, CHACKC ;ALARM CLOCK CHANGEMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0MOV 39H,#2LJMP ALARMCCHACKC:CJNE R4,#32, CHACKST ;ALARM CLOCK STARTMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0MOV 39H,#2LJMP ACKCHANGECHACKST:CJNE R4,#0, CHSCOREDISMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP ACKSTARTCHSCOREDIS:CJNE R4,#64, CHSCOREABMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0MOV 39H,#3LJMP CHOUTCHSCOREAB:CJNE R4,#160, CHSCOREINCMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP SCOREABCHSCOREINC:CJNE R4,#42, CHSCOREDECMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP SCOREINCCHSCOREDEC:CJNE R4,#178, CHDIANMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0LJMP SCOREDECCHDIAN:CJNE R4,#48, CHOUTMOV NO_OUT,#0H ;紅外遙控最終控制號碼存放單元清0MOV R0,#0E7H BACK_DIAN:MOV @R0,#0DH INC R0CJNE R0,#0F0H,BACK_DIANMOV 39H,#4CHOUT: RET;*********************;時鐘外部中斷程序;*********************INTOUT1:PUSH ACCPUSH PSW MOV PSW,#18HCLR EX1 MOV R4,#10SB: LCALL DL865 JB P3.3,EXIT DJNZ R4, SB JNB P3.3, $ LCALL DL4737 MOV R5,#16 JJJJA: JNB P3.3,$ LCALL DL865 MOV C,P3.3 JNC UUUALCALL DL1000 UUUA: DJNZ R5,JJJJAMOV R1,#22H MOV R2,#2 PP: MOV R3,#8 JJJJ: JNB P3.3,$ LCALL DL865 MOV C,P3.3 JNC UUULCALL DL1000 UUU: MOV A,@R1RLC A MOV @R1,A DJNZ R3,JJJJ INC R1DJNZ R2,PP MOV A,22HCPL A CJNE A,23H,EXIT MOV A,22HMOV NO_OUT,AEXIT: SETB EX1;MOV 3DH,#40CLR PSW.3CLR PSW.4POP PSWPOP ACC RETI ;**********************<<延時程序>>******************************;本程序完整版的下載地址:http://www.51hei.com/ziliao/file/dgndzz.rarDL865: MOV R7,#12 ; 1.09*(2R6+4)*R7+2 延時子程序1,精確延時865 微秒D1: MOV R6,#31DJNZ R6,$DJNZ R7,D1RETDL4737: MOV R7,#12 ;延時子程序2,精確延時4737 微秒D2: MOV R6,#179DJNZ R6,$DJNZ R7,D2RETDL1000: MOV R7,#17;延時程序3,精確延時1000 微秒D3: MOV R6,#25DJNZ R6,$DJNZ R7,D3RETDL40: MOV R7,#1;延時程序4,精確延時40/17 微秒D4: MOV R6,#1DJNZ R6,$DJNZ R7,D4RET ;*************************;秒表、定時器外部中斷程序;**************************INTOUT0: PUSH ACCPUSH BPUSH PSW CLR TR0 ;停止計數(shù)MOV 39H,#0MOV A,48H ; RL A MOV 48H,AJNB ACC.1,OUT0 ;查詢,A最低位為0時暫停計時,為1時繼續(xù)計時MOV TH0,#0DCH ;#0FFHMOV TL0,#00H ;#00HSETB TR0 ;開始計數(shù) OUT0: POP PSWPOP BPOP ACCRETI ;***************************; 時鐘溢出中斷程序;***************************COUNT1: PUSH ACCPUSH BPUSH PSW MOV TL1 ,#00H MOV TH1 ,#0DCH MOV A,NUMBER_H6 ;秒百分位INC AMOV NUMBER_H6,ACJNE A,#0AH,RETURN_1MOV NUMBER_H6,#00HMOV A,NUMBER_G6 ;秒十分位INC AMOV NUMBER_G6,ACJNE A,#0AH,RETURN_1MOV NUMBER_G6,#00HMOV A,NUMBER_F6 ;秒個位INC AMOV NUMBER_F6,ACJNE A,#0AH,RETURN_1MOV NUMBER_F6,#00HMOV A,NUMBER_E6 ;秒十位INC AMOV NUMBER_E6,ACJNE A,#06H,RETURN_1MOV NUMBER_E6,#00HMOV A,NUMBER_D6 ;分個位INC AMOV NUMBER_D6,ACJNE A,#0AH,RETURN_1MOV NUMBER_D6,#00HMOV A,NUMBER_C6 ;分十位INC AMOV NUMBER_C6,ACJNE A,#06H,RETURN_1MOV NUMBER_C6,#00HMOV A,NUMBER_A6CJNE A,#02H,GO_ON_1MOV A,NUMBER_B6 INC AMOV NUMBER_B6,ACJNE A,#04H,RETURN_1MOV NUMBER_B6,#00HMOV NUMBER_A6,#00HLJMP RETURN_1GO_ON_1: MOV A,NUMBER_B6 ;時個位INC AMOV NUMBER_B6,ACJNE A,#0AH,RETURN_1MOV NUMBER_B6,#00HMOV A,NUMBER_A6 ;時個位和時十位一同設(shè)置INC AMOV NUMBER_A6,ARETURN_1:POP PSWPOP BPOP ACCRETI ;散轉(zhuǎn);***************************; 秒表溢出中斷程序;***************************COUNT0: PUSH ACCPUSH BPUSH PSW MOV TL0 ,#00H MOV TH0 ,#0DCH MOV A, 49HJB ACC.0,TIMER0JB ACC.1,PENGLJMP RETURN_0PENG: LJMP STOP_00TIMER0:MOV A,NUMBER_H ;秒百分位INC AMOV NUMBER_H,ACJNE A,#0AH,RETURN_0MOV NUMBER_H,#00HMOV A,NUMBER_G ;秒十分位INC AMOV NUMBER_G,ACJNE A,#0AH,RETURN_0MOV NUMBER_G,#00H;MOV A,NUMBER_F ;秒個位INC AMOV NUMBER_F,ACJNE A,#0AH,RETURN_0MOV NUMBER_F,#00H;MOV A,NUMBER_E ;秒十位INC AMOV NUMBER_E,ACJNE A,#06H,RETURN_0MOV NUMBER_E,#00HMOV A,NUMBER_D ;分個位INC AMOV NUMBER_D,ACJNE A,#0AH,RETURN_0MOV NUMBER_D,#00HMOV A,NUMBER_C ;分十位INC AMOV NUMBER_C,ACJNE A,#06H,RETURN_0MOV NUMBER_C,#00HMOV A,NUMBER_ACJNE A,#02H,GO_ON_0MOV A,NUMBER_B INC AMOV NUMBER_B,ACJNE A,#04H,RETURN_0MOV NUMBER_B,#00HMOV NUMBER_A,#00HLJMP RETURN_0GO_ON_0: MOV A,NUMBER_B ;時個位INC AMOV NUMBER_B,ACJNE A,#0AH,RETURN_0MOV NUMBER_B,#00H;MOV A,NUMBER_A ;時個位和時十位一同設(shè)置INC AMOV NUMBER_A,ARETURN_0:POP PSWPOP BPOP ACCRETI ;散轉(zhuǎn);**************************;定時器計時中斷入口;****************************STOP_00:MOV A,NUMBER_H ;0.01秒位DEC AMOV NUMBER_H,ACJNE A,#0FFH,RETURN_00MOV A,NUMBER_ACJNE A,#0,REL_HMOV A,NUMBER_BCJNE A,#0,REL_HMOV A,NUMBER_CCJNE A,#0,REL_HMOV A,NUMBER_DCJNE A,#0,REL_HMOV A,NUMBER_ECJNE A,#0,REL_HMOV A,NUMBER_FCJNE A,#0,REL_HMOV A,NUMBER_GCJNE A,#0,REL_HMOV NUMBER_H,#00H LJMP RETURN_00 REL_H: MOV NUMBER_H,#09HLJMP WEI_GRETURN_00:LJMP RETURN_02WEI_G: MOV A,NUMBER_G ;0.1秒位DEC AMOV NUMBER_G,ACJNE A,#0FFH,RETURN_01MOV A,NUMBER_ACJNE A,#0,REL_GMOV A,NUMBER_BCJNE A,#0,REL_GMOV A,NUMBER_CCJNE A,#0,REL_GMOV A,NUMBER_DCJNE A,#0,REL_GMOV A,NUMBER_ECJNE A,#0,REL_GMOV A,NUMBER_FCJNE A,#0,REL_GMOV NUMBER_G,#00H LJMP RETURN_01 REL_G: MOV NUMBER_G,#09H;WEI_F: MOV A,NUMBER_F ;秒個位DEC AMOV NUMBER_F,ACJNE A,#0FFH,RETURN_01MOV A,NUMBER_ACJNE A,#0,REL_FMOV A,NUMBER_BCJNE A,#0,REL_FMOV A,NUMBER_CCJNE A,#0,REL_FMOV A,NUMBER_DCJNE A,#0,REL_FMOV A,NUMBER_ECJNE A,#0,REL_FMOV NUMBER_F,#00H AJMP RETURN_01 REL_F: MOV NUMBER_F,#09HAJMP WEI_ERETURN_01:LJMP RETURN_02; WEI_E: MOV A,NUMBER_E ;秒十位DEC AMOV NUMBER_E,ACJNE A,#0FFH,RETURN_02MOV A,NUMBER_ACJNE A,#0,REL_EMOV A,NUMBER_BCJNE A,#0,REL_EMOV A,NUMBER_CCJNE A,#0,REL_EMOV A,NUMBER_DCJNE A,#0,REL_EMOV NUMBER_E,#00H LJMP RETURN_02 REL_E: MOV NUMBER_E,#05H;WEI_D: MOV A,NUMBER_D ;分個位DEC AMOV NUMBER_D,ACJNE A,#0FFH,RETURN_02MOV A,NUMBER_ACJNE A,#0,REL_DMOV A,NUMBER_BCJNE A,#0,REL_DMOV A,NUMBER_CCJNE A,#0,REL_DMOV NUMBER_D,#00H LJMP RETURN_02 REL_D: MOV NUMBER_D,#09H;WEI_C: MOV A,NUMBER_C ;分十位DEC AMOV NUMBER_C,ACJNE A,#0FFH,RETURN_02MOV A,NUMBER_ACJNE A,#0,REL_CMOV A,NUMBER_BCJNE A,#0,REL_CMOV NUMBER_C,#00H LJMP RETURN_02 REL_C: MOV NUMBER_C,#05H;WEI_B: MOV A,NUMBER_B ;時個位DEC AMOV NUMBER_B,ACJNE A,#0FFH,RETURN_02MOV A,NUMBER_ACJNE A,#0,REL_BMOV NUMBER_B,#00H LJMP RETURN_02 REL_B: MOV NUMBER_B,#09H;WEI_A: MOV A,NUMBER_A ;時個位和時十位一同設(shè)置DEC AMOV NUMBER_A,ACJNE A,#0FFH,RETURN_02MOV NUMBER_A,#00HRETURN_02:MOV A,NUMBER_H2 ;秒百分位INC AMOV NUMBER_H2,ACJNE A,#0AH,RETURN_22MOV NUMBER_H2,#00H;MOV A,NUMBER_G2 ;秒十分位INC AMOV NUMBER_G2,ACJNE A,#0AH,RETURN_22MOV NUMBER_G2,#00H;MOV A,NUMBER_F2 ;秒個位INC AMOV NUMBER_F2,ACJNE A,#0AH,RETURN_22MOV NUMBER_F2,#00H;MOV A,NUMBER_E2 ;秒十位INC AMOV NUMBER_E2,ACJNE A,#06H,RETURN_22MOV NUMBER_E2,#00HMOV A,NUMBER_D2 ;分個位INC AMOV NUMBER_D2,ACJNE A,#0AH,RETURN_22MOV NUMBER_D2,#00HMOV A,NUMBER_C2 ;分十位INC AMOV NUMBER_C2,ACJNE A,#06H,RETURN_22MOV NUMBER_C2,#00HMOV A,NUMBER_A2CJNE A,#02H,GO_ON_22MOV A,NUMBER_B2INC AMOV NUMBER_B2,ACJNE A,#04H,RETURN_22MOV NUMBER_B2,#00HMOV NUMBER_A2,#00HLJMP RETURN_0GO_ON_22: MOV A,NUMBER_B2 ;時個位INC AMOV NUMBER_B2,ACJNE A,#0AH,RETURN_22MOV NUMBER_B2,#00H;MOV A,NUMBER_A2 ;時個位和時十位一同設(shè)置INC AMOV NUMBER_A2,ARETURN_22:POP PSWPOP BPOP ACCRETI END 上一頁 1 2 3 下一頁
評論