3 RTC n RTCABRTCALRMAR RTCALRMBR AB http eboard
ü 3. RTC常用寄存器 n RTC闹钟A/B寄存器(RTC_ALRMAR/ RTC_ALRMBR) 闹钟A和B描述一致 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü 3. RTC常用寄存器 n RTC闹钟A/B亚秒寄存器(RTC_ALRMASSR/ RTC_ALRMBSSR) 闹钟A和B描述一致 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 u RTC相关库函数讲解 l 库函数所在文件: stm 32 f 4 xx_rtc. c / stm 32 f 4 xx_rtc. h 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 u RTC相关常用库函数讲解 Error. Status RTC_Init(RTC_Init. Type. Def* RTC_Init. Struct); Error. Status RTC_Enter. Init. Mode(void); void RTC_Exit. Init. Mode(void); Error. Status RTC_Set. Time(uint 32_t RTC_Format, RTC_Time. Type. Def* RTC_Time. Struct); void RTC_Get. Time(uint 32_t RTC_Format, RTC_Time. Type. Def* RTC_Time. Struct); uint 32_t RTC_Get. Sub. Second(void); Error. Status RTC_Set. Date(uint 32_t RTC_Format, RTC_Date. Type. Def* RTC_Date. Struct); void RTC_Get. Date(uint 32_t RTC_Format, RTC_Date. Type. Def* RTC_Date. Struct); void RTC_Set. Alarm(); void RTC_Get. Alarm(); Error. Status RTC_Alarm. Cmd(uint 32_t RTC_Alarm, Functional. State New. State); void RTC_Alarm. Sub. Second. Config(uint 32_t RTC_Alarm, uint 32_t RTC_Alarm. Sub. Second. Value, uint 32_t RTC_Alarm. Sub. Second. Mask); uint 32_t RTC_Get. Alarm. Sub. Second(uint 32_t RTC_Alarm); 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 u RTC相关库函数讲解 l RTC时钟源和时钟操作函数: void RCC_RTCCLKConfig(uint 32_t CLKSource);//时钟源选择 void RCC_RTCCLKCmd(Functional. State New. State)//时钟使能 l RTC初始化函数 Error. Status RTC_Init(RTC_Init. Type. Def* RTC_Init. Struct); typedef struct { uint 32_t RTC_Hour. Format; //小时格式: 24/12 uint 32_t RTC_Asynch. Prediv; //异步分频 系数 uint 32_t RTC_Synch. Prediv; //同步分频系数 }RTC_Init. Type. De 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 l RTC日历配置相关函数 Error. Status RTC_Set. Time(uint 32_t RTC_Format, RTC_Time. Type. Def* RTC_Time. Struct); void RTC_Get. Time(uint 32_t RTC_Format, RTC_Time. Type. Def* RTC_Time. Struct); Error. Status RTC_Set. Date(uint 32_t RTC_Format, RTC_Date. Type. Def* RTC_Date. Struct); void RTC_Get. Date(uint 32_t RTC_Format, RTC_Date. Type. Def* RTC_Date. Struct); uint 32_t RTC_Get. Sub. Second(void); 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 l RTC闹钟相关函数 Error. Status RTC_Alarm. Cmd(uint 32_t RTC_Alarm, Functional. State New. State) void RTC_Set. Alarm(uint 32_t RTC_Format, uint 32_t RTC_Alarm, RTC_Alarm. Type. Def* RTC_Alarm. Struct); void RTC_Get. Alarm(uint 32_t RTC_Format, uint 32_t RTC_Alarm, RTC_Alarm. Type. Def* RTC_Alarm. Struct); void RTC_Alarm. Sub. Second. Config(uint 32_t RTC_Alarm, uint 32_t RTC_Alarm. Sub. Second. Value, uint 32_t RTC_Alarm. Sub. Second. Mask) uint 32_t RTC_Get. Alarm. Sub. Second(uint 32_t RTC_Alarm); 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 l RTC周期唤醒相关函数 void RTC_Wake. Up. Clock. Config(uint 32_t RTC_Wake. Up. Clock); void RTC_Set. Wake. Up. Counter(uint 32_t RTC_Wake. Up. Counter); uint 32_t RTC_Get. Wake. Up. Counter(void); RTC_Wake. Up. Cmd(DISABLE); //关闭WAKE UP l RTC 中断配置以及状态相关函数 void RTC_ITConfig(uint 32_t RTC_IT, Functional. State New. State); Flag. Status RTC_Get. Flag. Status(uint 32_t RTC_FLAG); void RTC_Clear. Flag(uint 32_t RTC_FLAG); ITStatus RTC_Get. ITStatus(uint 32_t RTC_IT); void RTC_Clear. ITPending. Bit(uint 32_t RTC_IT); 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 l RTC相关约束函数 void RTC_Write. Protection. Cmd(Functional. State New. State); //取消写保护 Error. Status RTC_Enter. Init. Mode(void); //进入配置模式,RTC_ISR_INITF位设置为 1 void RTC_Exit. Init. Mode(void)//退出初始化模式。 l 其他相关函数 uint 32_t RTC_Read. Backup. Register(uint 32_t RTC_BKP_DR); void RTC_Write. Backup. Register(uint 32_t RTC_BKP_DR, uint 32_t Data) void RTC_ITConfig(uint 32_t RTC_IT, Functional. State New. State); 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 n RTC日历配置一般步骤 ① 使能PWR时钟:RCC_APB 1 Periph. Clock. Cmd(); ② 使能后备寄存器访问: PWR_Backup. Access. Cmd(); ③ 配置RTC时钟源,使能RTC时钟: RCC_RTCCLKConfig(); RCC_RTCCLKCmd(); 如果使用LSE,要打开LSE:RCC_LSEConfig(RCC_LSE_ON); ④ 初始化RTC(同步/异步分频系数和时钟格式):RTC_Init (); ⑤ 设置时间:RTC_Set. Time (); ⑥设置日期:RTC_Set. Date(); 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 n RTC闹钟配置一般步骤 ① RTC已经初始化好相关参数。 ② 关闭闹钟:RTC_Alarm. Cmd(RTC_Alarm_A, DISABLE); ③ 配置闹钟参数:RTC_Set. Alarm(); ④ 开启闹钟:RTC_Alarm. Cmd(RTC_Alarm_A, EABLE); ⑤ 开启配置闹钟中断: RTC_ITConfig(); EXTI_Init(); NVIC_Init(); ⑤编写中断服务函数:RTC_Alarm_IRQHandler(); 淘宝店铺:http: //eboard. taobao. com 技术论坛
ü RTC原理 n RTC周期性自动唤醒配置一般步骤 ① RTC已经初始化好相关参数。 ② 关闭Wake. Up:RTC_Wake. Up. Cmd(DISABLE); ③ 配置Wake. Up时钟分频系数/来源: RTC_Wake. Up. Clock. Config(); ④ 设置Wake. Up自动装载寄存器: RTC_Set. Wake. Up. Counter(); ① 使能Wake. Up : RTC_Wake. Up. Cmd( ENABLE); ② 开启配置闹钟中断: RTC_ITConfig(); EXTI_Init(); NVIC_Init(); ⑤编写中断服务函数: RTC_WKUP_IRQHandler(); 淘宝店铺:http: //eboard. taobao. com 技术论坛
- Slides: 34