if(ma_start==1)
{
tt++;
if(tt==8)
{
tt=0;xiaomiao++;
if(xiaomiao==99)
{
xiaomiao=0;miao++;
if(miao==60)
{
miao=0;fen++;
if(fen==99)
{
fen=0;
}
}
}
}
}
}
Screen.c:
#include"reg52.h"
#include"macroconst.h"
#include"delay.h"
#include"18b20.h"
#include"atao_12864.h"
#include"ds1302.h"
#include"24c02.h"
#include"festival.h"
#include"keyscan.h"
idataunsignedcharmiao=0,fen=78,xiaomiao=0,tt=0;
idataunsignedcharbai,shi,ge,shinian,genian,shiyue,geyue,shiri,geri,shishi,geshi,shifen,gefen,shimiao,gemiao;
idataunsignedcharNumber[4];
unsignedcharcodemainmenu[]={
"主菜单"
"3.查询4.温度"
"1.调时2.秒表"
"5.设置6.返回"
};
unsignedcharcodesetmenu[]={
"设置"
"3.查温4.按键"
"1.界面2.闹铃"
"5.报时6.返回"
};
voidgettime()
{
shinian=(time_buf1[1]%100)/10;
genian=(time_buf1[1]%100)%10;
shiyue=(time_buf1[2])/10;
geyue=(time_buf1[2])%10;
shiri=(time_buf1[3])/10;
geri=(time_buf1[3])%10;
shishi=(time_buf1[4])/10;
geshi=(time_buf1[4])%10;
shifen=(time_buf1[5])/10;
gefen=(time_buf1[5])%10;
shimiao=(time_buf1[6])/10;
gemiao=(time_buf1[6])%10;
}
voidscreen_select(ucharnum)
{
//initina1();
gettime();
if(num==1)//----------主界面
{
Lcd_Set_Post(1,0);
TransferData(shinian+48,1);//----------------------年
TransferData(genian+48,1);
TransferData('/',1);
TransferData(shiyue+48,1);//----------------------月
TransferData(geyue+48,1);
TransferData('/',1);
TransferData(shiri+48,1);//----------------------日
TransferData(geri+48,1);
Lcd_Set_Post(1,4);
if(state[1]==1)//----------------闹铃的状态图标
{
TransferData('',1);
TransferData(14,1);
}
Lcd_Set_Post(1,5);
if(key_sound==1)
{
TransferData(13,1);
}
if(state[0]==0)
{
Lcd_Set_Post(1,7);//----------------农历年
nian(0);
Lcd_Set_Post(2,0);//-----------------------农历日月
LCD_WRITE_CHAR("农历");
Conversion(0,time_buf[1],time_buf[2],time_buf[3]);
TransferData(month_moon/16+'0',1);
TransferData(month_moon%16+'0',1);
TransferData('/',1);
TransferData(day_moon/16+'0',1);
TransferData(day_moon%16+'0',1);
}
if(state[0]==1){Lcd_Set_Post(3,5);}else{Lcd_Set_Post(2,5);}
LCD_WRITE_CHAR("星期");//----------------------星期
if(time_buf1[7]==7){LCD_WRITE_CHAR("日");}
if(time_buf1[7]==6){LCD_WRITE_CHAR("六");}
if(time_buf1[7]==5){LCD_WRITE_CHAR("五");}
if(time_buf1[7]==4){LCD_WRITE_CHAR("四");}
if(time_buf1[7]==3){LCD_WRITE_CHAR("三");}
if(time_buf1[7]==2){LCD_WRITE_CHAR("二");}
if(time_buf1[7]==1){LCD_WRITE_CHAR("一");}
Lcd_Set_Post(3,0);
TransferData(shishi+48,1);//----------------------时
TransferData(geshi+48,1);
TransferData(58,1);
TransferData(shifen+48,1);//----------------------分
TransferData(gefen+48,1);
TransferData(58,1);
TransferData(shimiao+48,1);//----------------------秒
TransferData(gemiao+48,1);
if(state[0]==0)
{
bai=(temph/100);//---------------------------------温度
shi=(temph%100)/10;
ge=(temph%100)%10;
Lcd_Set_Post(3,4);
if(zerotemp==0){TransferData('',1);TransferData('',1);}
Lcd_Set_Post(3,5);
TransferData(shi+48,1);
TransferData(ge+48,1);
TransferData('.',1);
TransferData(templ+48,1);
TransferData(0xa1,1);TransferData(0xe6,1);
Lcd_Set_Post(4,0);
festival(time_buf[2],time_buf[3],time_buf[4]);//农历
}
}
if(num==3)//----------主菜单
{
Lcd_Set_Post(1,0);//--------设置显示位置
LCD_WRITE_CHAR(mainmenu);
}
if(num==4)//----------设置菜单
{
Lcd_Set_Post(1,0);//--------设置显示位置
LCD_WRITE_CHAR(setmenu);
}
if(num==5)//----------时间设置
{
Lcd_Set_Post(1,2);//--------设置显示位置
LCD_WRITE_CHAR("时间设置");
Lcd_Set_Post(2,1);
TransferData(shinian+48,1);//----------------------年
TransferData(genian+48,1);
LCD_WRITE_CHAR("年");
TransferData(shiyue+48,1);//----------------------月
TransferData(geyue+48,1);
LCD_WRITE_CHAR("月");
TransferData(shiri+48,1);//----------------------日
TransferData(geri+48,1);
LCD_WRITE_CHAR("日");
TransferData(time_buf1[7]+48,1);//---------------星期
Lcd_Set_Post(3,2);
TransferData(shishi+48,1);//--------------------时
TransferData(geshi+48,1);
LCD_WRITE_CHAR("时");
TransferData(shifen+48,1);//---------------------分
TransferData(gefen+48,1);
LCD_WRITE_CHAR("分");
TransferData(shimiao+48,1);//--------------------秒
TransferData(gemiao+48,1);
}
if(num==6)//----------秒表
{
ucharshi1,shi2,shi3,ge1,ge2,ge3;
Lcd_Set_Post(1,3);//--------设置显示位置
LCD_WRITE_CHAR("秒表");
Lcd_Set_Post(3,2);
shi1=fen/10;
ge1=fen%10;
TransferData(shi1+48,1);
TransferData(ge1+48,1);
TransferData(':
',1);
shi2=miao/10;
ge2=miao%10;
TransferData(shi2+48,1);
TransferData(ge2+48,1);
TransferData(':
',1);
shi3=xiaomiao/10;
ge3=xiaomiao%10;
TransferData(shi3+48,1);
TransferData(ge3+48,1);
}
if(num==8)
{
Lcd_Set_Post(1,2);//--------农历查询
LCD_WRITE_CHAR("温度查询");
Lcd_Set_Post(3,0);//--------农历查询
LCD_WRITE_CHAR("最高温度");
TransferData(':
',1);
RdFromROM(Number,0,4);
if(Number[3]==0){TransferData('-',1);}
Lcd_Set_Post(3,5);
TransferData(Number[0]+48,1);
TransferData(Number[1]+48,1);
TransferData('.',1);
TransferData(Number[2]+48,1);
TransferData(0xa1,1);TransferData(0xe6,1);
Lcd_Set_Post(4,0);//--------农历查询
LCD_WRITE_CHAR("最低温度");
TransferData(':
',1);
RdFromROM(Number,4,4);
if(Number[3]==0){TransferData('-',1);}
Lcd_Set_Post(4,5);
TransferData(Number[0]+48,1);
TransferData(Number[1]+48,1);
TransferData('.',1);
TransferData(Number[2]+48,1);
TransferData(0xa1,1);TransferData(0xe6,1);
}
if(num==9)//----------界面菜单
{
Lcd_Set_Post(1,2);//--------设置显示位置
LCD_WRITE_CHAR("界面选择");
Lcd_Set_Post(2,0);
TransferData(1+48,1);
TransferData('.',1);
LCD_WRITE_CHAR("多功能界面");
Lcd_Set_Post(3,0);
TransferData(2+48,1);
TransferData('.',1);
LCD_WRITE_CHAR("简洁界面");
}