|
void Init_Rtc(void)
{ // BCD码日历格式输出
RTCCTL01 = RTCBCD + RTCHOLD + RTCMODE + RTCTEV_0 ;
RTCPS0CTL = RT0PSHOLD ; //配置两个计数器分频
RTCPS1CTL = RT1PSHOLD ;
RTCSEC = 0x54; //初始化秒
RTCMIN = 0X59 ; //初始化分钟
RTCHOUR =0X21; //初始化小时
RTCDOW = 0X02 ;
//RTCTIM1 = 0X0421;
RTCDAY = 0x24; //日期初始化
RTCMON = 0X11 ; //初始化月份
RTCYEAR = 0x2005; //初始化年份
RTCAMINHR = 0X2200 + BIT7; //闹钟小时和分钟设置
RTCADOWDAY = 0X2402; //闹钟星期和日期设置
RTCCTL01 &= ~RTCHOLD; //打开RTC模块
RTCPS0CTL &= ~RT0PSHOLD; //打开RTCPS0CTL
RTCPS1CTL &= ~RT1PSHOLD; //打开RTCPS1CTL
RTCCTL0 |= RTCAIE + RTCRDYIE; //打开安全访问使能 ,闹钟使能
}
|
|