📄 main.c
字号:
#include <stdio.h>
#include <string.h>
//#include "44b.h"
#include "inc\common.h"
#include "inc\44blib.h"
#include "inc\rtc.h"
TIME_STRUC t;
extern char *WeekDay[7] ;
unsigned char Int2BCD(unsigned int num)
{
return (unsigned char)(((num/10)<<4)|(num%10));
}
void SetRtc(void)
{
uint i;
int y,a,b,c;
Uart_Printf("Input Year[0-99]:");
t.year = Int2BCD((unsigned char)Uart_GetNumForRtc());
Uart_Printf("Input Month[1-12]:");
t.month = Int2BCD((unsigned char)Uart_GetNumForRtc());
Uart_Printf("Input Day[1-31]:");
t.day = Int2BCD((unsigned char)Uart_GetNumForRtc());
RtcSetDay(&t);
Uart_Printf("Input weekday[1-7]:");
t.weekday = Int2BCD((unsigned char)Uart_GetNumForRtc());
RtcSetWeek(&t);
Uart_Printf("Input hour[0-23]:");
t.hour = Int2BCD((unsigned char)Uart_GetNumForRtc());
Uart_Printf("Input min[0-59]:");
t.min = Int2BCD((unsigned char)Uart_GetNumForRtc());
Uart_Printf("Input sec[0-59]:");
t.sec = Int2BCD((unsigned char)Uart_GetNumForRtc());
RtcSetTime(&t);
RtcInit(&t);
}
int Main(void)
{
Board_Init();
SetRtc();
while(1)
{
Display_Rtc();
Delay(20000);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -