|
程序如下
#include <REGX52.H>
#include "LCD1602.h"
#include "DS1302.h"
void Delay1ms(unsigned int count)
{
unsigned int i,j;
for(i=0;i<count;i++)
for(j=0;j<120;j++);
}
main()
{
SYSTEMTIME CurrentTime;
LCD_Initial();
Initial_DS1302();
GotoXY(0,0);
Print("Date: ");
GotoXY(0,1);
Print("Time: ");
while(1)
{
DS1302_GetTime(&CurrentTime);
DateToStr(&CurrentTime);
TimeToStr(&CurrentTime);
GotoXY(6,0);
Print(CurrentTime.DateString);
GotoXY(6,1);
Print(CurrentTime.TimeString);
Delay1ms(300);
}
}
|
-
捕獲.PNG
(81.59 KB, 下載次數(shù): 40)
下載附件
2020-4-6 11:37 上傳
-
-
ds1302時(shí)鐘.zip
2020-4-6 11:37 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
145.26 KB, 下載次數(shù): 64, 下載積分: 黑幣 -5
|