;;///////////////////////////////////////////////////////////;;
;;[汇编原创]c51超长时间延时程序1小时到1000...小时。
;;19:44 2007-3-10;;
;;6MHZ晶振为100ms;若晶振为12mhz时则50ms;进入一次定时中断;;
;;你用定时中断0方式1,进一次中断,中断内加1如:inc 40h;
;;RUN COMMAND;;执行命令;;
;;///////////////////////////////////////////////////////////;;
ORG 0000H
AJMP MAIN
ORG 000BH
AJMP ET0_0
RETI
ORG 0030H
MAIN:
MOV SP,#10H
MOV TMOD,#01H
MOV IE,#82H
MOV TH0,#(65536-50000)/256
MOV TL0,#(65536-50000)MOD 256
MOV TCON,#10H
MOV 40H,#00H;;毫秒
MOV 41H,#00H;;秒
MOV 42H,#00H;;分
MOV 43H,#00H;;时
MOV 44H,#00H;;日
;;..
LOOP:
NOP
MOV A,40H
CJNE A,#10,TIME1;;10*100ms=1000ms=1s
MOV 40H,#00H
;;RUN COMMAND;;
INC 41H
MOV A,41H
CJNE A,#60,TIME1;;60*1s=1分钟
MOV 41H,#00H
MOV 40H,#00H
;;RUN COMMAND;;
INC 42H
MOV A,42H
CJNE A,#60,TIME1;;60*1MIN=60分钟=1小时;;
MOV 42H,#00H
MOV 41H,#00H
MOV 40H,#00H
;;RUN COMMAND;;
INC 43H
MOV A,43H
CJNE A,#24,TIME1;;24*1小时=1天
MOV 43H,#00H
MOV 42H,#00H
MOV 41H,#00H
MOV 40H,#00H
;;RUN COMMAND;;执行命令;;
INC 44H
MOV A,44H
CJNE A,#30,TIME1;;1天*30=1个月;;
MOV 44H,#00H
MOV 43H,#00H
MOV 42H,#00H
MOV 41H,#00H
MOV 40H,#00H
;;RUN COMMAND;;
TIME1:
MOV PCON,#01H
AJMP LOOP
ET0_0:
NOP
INC 40H
MOV TH0,#(65536-50000)/256;;
MOV TL0,#(65536-50000)MOD 256
RETI
END
上一篇:Keli C51学习
下一篇:89c51按键选择计数模式通过数码管显示
推荐阅读最新更新时间:2024-03-16 15:21
- 热门资源推荐
- 热门放大器推荐