📄 main.c
字号:
#include <at89X52.h>
#include "ds1302new.h"
#include "LCD1602.h"
TDateTime CurrectValue; //定义一个结构体,用于存储日期时间信息
unsigned char *WeekStr[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
void main(void)
{
LCD_init();
init_ds1302();
P2_1=0;
GetCurrentDateTime(&CurrectValue);
CurrectValue.Year=7;
CurrectValue.Month=10;
CurrectValue.MonthDay=27;
CurrectValue.WeekDay=7;
CurrectValue.Hour=15;
CurrectValue.Min=42;
CurrectValue.Sec=0;
SetDateTime(&CurrectValue);
p=LCD_PutStr(" DS1302RealTimer \n",-1);
p=LCD_PutStr("WWW.BQMCU.COM.CN \n",p);
delay_nms(300);
p=LCD_PutStr("",-1);
while(1){
GetCurrentDateTime(&CurrectValue);
p=0;
p=LCD_PutStr(CurrectValue.DateStr,p);
p=LCD_PutStr(" ",p);
p=LCD_PutStr(WeekStr[CurrectValue.WeekDay-1],p);
p=LCD_PutStr("\n",p);
p=LCD_PutStr(CurrectValue.TimeStr,p);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -