可实现功能:
启动程序数码管按照××-××-××格式显示时分秒并走时
按下C1按钮后按照××-××-××格式显示年月日
按下C3调时模式按钮时分秒/年月日静止,指示灯亮起,进入调时模式
先按C2选位按钮再按下C0加一按钮,对应的位置改变
再次按下C3按钮退出调时模式,继续走时
#include<reg51.h>
#define uChar unsigned char
#define uInt unsigned int
uChar a []={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uChar b []={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uChar second=00,minute=00,hour=10,year=17,month=01,day=11,count;
sbit Key1 = P3^7; //计时停止
sbit Key2 = P3^6; //调位
sbit Key3 = P3^0; //加一
sbit Key4 = P3^2; //切换
sbit LED1 = P1^7;
void Delayms(uInt t)
{
uInt i,j;
for(i=0;i<t;i++)
for(j=0;j<125;j++)
;
}
void Dispaly1(uChar second,uChar minut