KF32L/LS 提供多种模式供用户在不同工作场景下使用。包含两种运行模式、两
种休眠模式及三种低功耗模式。
KF32L/LS 提供用户实时时间以及日历信息的高精度实时时钟。
本应用笔记将以 KF32L530 为例介绍如何配置进入低功耗停止模式和待机模式。
本应用笔记使用的 KF32 IDE 与 KF32Lxxx 外设固件库及代码例程可以从 ChipON
官方网站 www.chipon-ic.com 下载。
Github:https://github.com/ChipON-FAE-AE
Gitee:https://gitee.com/Cucoo/BSP
- /* MCU运行所需头文件 */
- #include "system_init.h"
- /* 功耗管理所需头文件 */
- #include "PowerManger.h"
- /* 调用外部函数 */
- extern void startup();
- void main()
- {
- /* 备份域使能 */
- SystemBKPEnable();
- if (Query_System_PowerOn_State() == TRUE)
- {
- /* 系统时钟配置 */
- SystemInit();
- /* RAM初始化 */
- startup();
- /* 写入上电标志 */
- Write_SystemPowerOn_State();
- /* standby模式配置,使能节拍中断 */
- System_Standby_Configuration();
- System_GotoSleep();
- }
- else
- {
- INT_All_Enable(FALSE); //关闭系统总中断
- INT_Interrupt_Enable(INT_EINT19TO17, FALSE); //关闭RTC节拍中断
- SFR_CLR_BIT_ASM(PM_CTL2, PM_CTL2_RTCTPEN_POS);
- SFR_CLR_BIT_ASM(PM_CTL2, PM_CTL2_RTCTWEN_POS);
- /* 系统时钟配置 */
- SystemInit();
- /* RAM初始化 */
- startup();
- }
- while(1)
- {
- /* do something...
- ...
- */
- System_GotoSleep();
- }
- }
|