微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 51单片机+1602液晶万年历程序

51单片机+1602液晶万年历程序

时间:11-30 来源:互联网 点击:

//if(15<=miao)/*当秒大于15时才显示*/
//{
if(((miao/10==1)||(miao/10==3))&&(miao%10>=5))
{
switch(flag/100)//取出温度的十位数
{
case 0:print(0x80,"Pretty cold now!");
break;
case 1:print(0x80,"little cold now!");
break;
case 2:print(0x80,"It is warm now. ");
break;
case 3:print(0x80,"Its hot !!! ");
break;
case 4:print(0x80,"Very very hot!!!");
break;
case 5:print(0x80,"Very very hot!!!");
break;
case 6:print(0x80,"Very very hot!!!");
break;
}

//print(0x80,"It is warm now. ");
print(0x40," : : ");
writetemp(9,flag);//显示温度,第二行显示
writetime(6,miao);//显示出秒
writetime(3,fen);//显示出分
writetime(0,shi);//显示出时,第二行第一个开始
}
if(((miao/10==2)||(miao/10==4))&&(miao%10>=5))/*25-30 45-50*/
{
if((5<=shi)&&(shi<=11)) flagT=1;//5-11时为早上
if((11if((14if((18switch(flagT)//分段时间
{
case 1:print(0x80," Good Morning! ");
break;
case 2:print(0x80," Good Noon! ");
break;
case 3:print(0x80,"Good afternoon! ");
break;
case 4:print(0x80," Good night! ");
break;
}
print(0x40," : : ");
writetemp(9,flag);//显示温度,第二行显示
writetime(6,miao);//显示出秒
writetime(3,fen);//显示出分
writetime(0,shi);//显示出时,第二行第一个开始
}

if(((30<=miao)&&(miao<35))||((50<=miao)&&(miao<54)))//30-35 50-54
{//else改为范围
festival();//选择显示节日
}
//}
}
void timer1() interrupt 3//任务:计时用作报时
{
TH1=(65536-50000)/256;//中断后重新赋初值
TL1=(65536-50000)%256;
//count++;//计算时间
if(alarmflag==1)//设置键按下才有效
{
if(fen==0 && miao<4)
{
count++;
ledcount=count/10;//分开时间段
switch(ledcount)
{
case 0:Gled=0;Yled=1;break;//从零开始
case 1:Gled=1;Yled=0;break;
case 2:Gled=0;Yled=1;break;
case 3:Gled=1;Yled=0;break;
case 4:Gled=0;Yled=0;break;
case 5:Gled=1;Yled=1;break;
case 6:Gled=0;Yled=0;break;
case 7:Gled=0;Yled=0;count=0;break;//在这里面清零
}
}
else if(fen==30 && miao<2)
{
Gled=0;
Yled=0;
}
else {
Gled=1;
Yled=1;
}
}
}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top