#include<reg52.h>
#include<8x16.h>
#include<GB1616.h>
#include<GB2424.h>
#include<ds1302.h>
#include<DS18B20.h>
#include<LCDTFT.h>//彩屏头文件
unsigned int temp1;
sbit Bee = P1^0;
void disp(void)
{
unsigned char FirstLine[10];
//显示年、月、日
FirstLine[0]='2';
FirstLine[1]='0';
FirstLine[2]='0'+time_buf1[1]/10;
FirstLine[3]='0'+time_buf1[1]%10;
FirstLine[4]='-';
FirstLine[5]='0'+time_buf1[2]/10;
FirstLine[6]='0'+time_buf1[2]%10;
FirstLine[7]='-';
FirstLine[8]='0'+time_buf1[3]/10;
FirstLine[9]='0'+time_buf1[3]%10;
Lcd_PutString(80,70,FirstLine,0x00ff,0xff00);
//显示时、分、秒
FirstLine[0]=' ';
FirstLine[1]='0'+time_buf1[4]/10;
FirstLine[2]='0'+time_buf1[4]%10;
FirstLine[3]=':';
FirstLine[4]='0'+time_buf1[5]/10;
FirstLine[5]='0'+time_buf1[5]%10;
FirstLine[6]=':';
FirstLine[7]='0'+time_buf1[6]/10;
FirstLine[8]='0'+time_buf1[6]%10;
FirstLine[9]=' ';
Lcd_PutString(80,140,FirstLine,0x00ff,0xff00);
//判断星期
FirstLine[9]=time_buf1[7]%10;
if(FirstLine[9]==0){PutGB1616(128,85,"0",0x001f,0xff00);}//水平位,垂直位,字符,字体色,背景色
if(FirstLine[9]==1){PutGB1616(128,85,"1",0x001f,0xff00);}
if(FirstLine[9]==2){PutGB1616(128,85,"2",0x001f,0xff00);}
if(FirstLine[9]==3){PutGB1616(128,85,"3",0x001f,0xff00);}
if(FirstLine[9]==4){PutGB1616(128,85,"4",0x001f,0xff00);}
if(FirstLine[9]==5){PutGB1616(128,85,"5",0x001f,0xff00);}
if(FirstLine[9]==6){PutGB1616(128,85,"6",0x001f,0xff00);}
if(FirstLine[9]==7){PutGB1616(128,85,"日",0x001f,0xff00);}
}
void disp_Tmp()
{
unsigned char Wendu[10];
Wendu[0]=' ';
Wendu[1]=' ';
Wendu[2]='0'+temp1/100;
Wendu[3]='0'+temp1%100/10;
Wendu[4]='.';
Wendu[5]='0'+temp1%10;
Wendu[6]=' ';
Wendu[7]='C';
Wendu[8]=' ';
Wendu[9]=' ';
Lcd_PutString(80,190,Wendu,0x00ff,0xff00);
}
void main()
{
uchar x=0;
LCD_CS = 1;
delayms(25);
LCD_RST = 0;
delayms(150);
LCD_RST = 1;
delayms(25);
ILI9325_Initial();
ds1302_init();
ClearScreen(0xffff);
PutGB2424(65,40,"当",0x001f,0xffff);
PutGB2424(90,40,"前",0x001f,0xffff);
PutGB2424(115,40,"日",0x001f,0xffff);
PutGB2424(140,40,"期",0x001f,0xffff);
Lcd_PutString(80,85," 星期 ",0x00ff,0xff00);
PutGB2424(65,110,"当",0x001f,0xffff);
PutGB2424(90,110,"前",0x001f,0xffff);
PutGB2424(115,110,"时",0x001f,0xffff);
PutGB2424(140,110,"间",0x001f,0xffff);
PutGB2424(65,160,"当",0x001f,0xffff);
PutGB2424(90,160,"前",0x001f,0xffff);
PutGB2424(115,160,"温",0x001f,0xffff);
PutGB2424(140,160,"度",0x001f,0xffff);
//ds1302_write_time();
while(1)
{
tmpchange();
temp1 = tmp();
ds1302_read_time();//读取时钟信息
disp(); //液晶显示时间信息
disp_Tmp();
}
}