可调时间万年历c程序

上传人:kms****20 文档编号:41038296 上传时间:2018-05-28 格式:DOC 页数:14 大小:36.50KB
返回 下载 相关 举报
可调时间万年历c程序_第1页
第1页 / 共14页
可调时间万年历c程序_第2页
第2页 / 共14页
可调时间万年历c程序_第3页
第3页 / 共14页
可调时间万年历c程序_第4页
第4页 / 共14页
可调时间万年历c程序_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《可调时间万年历c程序》由会员分享,可在线阅读,更多相关《可调时间万年历c程序(14页珍藏版)》请在金锄头文库上搜索。

1、可调时间万年历可调时间万年历 C C 程序程序#include#include#define uchar unsigned char#define uint unsigned intsbit P2_0=P20;sbit dula1=P24;sbit wela1=P25;sbit dula=P26;sbit wela=P27;sbit P2_1=P21; sbit P2_3=P23; /按键 1 4 9 16uchar code tabledu=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0

2、x71;uchar code tabledu1=0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef,0xf7,0xfc,0xb9,0xde,0xf9,0xf1;uchar a,b,c,d,e,f,g,h;uchar sec,min,hour,day=04,mnt=01;uchar flag=0;uint num,num1=6,num2,year=2013;display(uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar,uchar

3、,uchar);delay(uchar);void time();void time1();void tz();void main()TMOD=0x52;EA=1;ET0=1;ET1=1;EX0=1;TH0=0x06;TL0=0x06;TH1=0xf0; /主函数TL1=0xd7;IT0=1;TR0=1;TR1=1;while(1)if(num1=8)num1=1;tz();display(num1,17,hour/10,hour%10,min/10,min%10,sec/10,sec%10,year/1000,year/100%10,year/10%10,year%10,mnt/10,mnt

4、%10,day/10,day%10);time();if(flag=1)time1();flag=0;void int0() interrupt 0 using 1TR0=0;TR1=0;num2+;void t0() interrupt 1 using 2TH0=0x06;TL0=0x06;P2_0=1;P2_0=0;void t1() interrupt 3 using 3TH1=0xf0;TL1=0xd7;sec+;void time()if(sec=60)sec=0; /时 分 秒min+;if(min=60)min=0;hour+;if(hour=24)hour=0;flag=1;v

5、oid time1()uchar day1;if(day=28)if(mnt=2)if(year%4=0elseday1=29;elseswitch(mnt)case 1: day1=32; /年 月 日break;case 3: day1=32;break;case 4: day1=31;break;case 5: day1=32;break;case 6: day1=31;break;case 7: day1=32;break;case 8: day1=32;break;case 9: day1=31;break;case 10: day1=32;break;case 11: day1=3

6、1;break;case 12: day1=32;break;day+;num1+;if(day=day1)mnt+;day=0;if(mnt=12)year+;mnt=0;void tz()if(TR0=0 /调整时间if(P2_1=0)sec+;while(P2_1=0);if(num2=2if(P2_1=0)min+;while(P2_1=0);if(num2=3if(P2_1=0)hour+;while(P2_1=0);if(num2=4if(P2_1=0)num1+;while(P2_1=0);if(num2=5if(P2_1=0)day+;while(P2_1=0);if(num2

7、=6if(P2_1=0)mnt+;while(P2_1=0);if(num2=7if(P2_1=0)year+;while(P2_1=0);if(num2=8)TR0=1;TR1=1;num2=0;display(uchar a,uchar b,uchar c,uchar d,uchar e,uchar f,uchar g,uchar h,uchar i,uchar j,uchar k,uchar l,uchar m,uchar n,uchar o,uchar p)uchar temp;temp=0x0f;P1=0xff;wela=1;/消除余晖wela=0;P1=tabledua;dula=

8、1;dula=0;temp=temp+1;P1=0x00;wela=1; wela=0;delay(1);/*P1=0xff;wela=1;/消除余晖wela=0;P1=tabledub;dula=1;dula=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);*/P1=0xff;wela=1;/消除余晖wela=0;P1=tableduc;dula=1;dula=0;temp=temp+2;P1=temp;wela=1;wela=0;delay(1); /数码管显示P1=0xff;wela=1;/消除余晖wela=0;P1=tabledu1d;dula

9、=1;dula=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledue;dula=1;dula=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledu1f;dula=1;dula=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledug;dula=1;dula=0;t

10、emp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tableduh;dula=1;dula=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledui;dula1=1;dula1=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tableduj;dula1=1;dula1=0;temp=temp

11、+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tableduk;dula1=1;dula1=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledu1l;dula1=1;dula1=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledum;dula1=1;dula1=0;temp=temp+1;P1

12、=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledu1n;dula1=1;dula1=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tableduo;dula1=1;dula1=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);P1=0xff;wela=1;/消除余晖wela=0;P1=tabledup;dula1=1;dula1=0;temp=temp+1;P1=temp;wela=1;wela=0;delay(1);delay(uchar x)uchar a,b;for(a=x;a0;a-) /延时for(b=200;b0;b-);

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号