MKL25-Computer operating properly (COP) watchdog timer
1、.c文件内容
/* * cop.c * * Created on: 2020年8月26日 * Author: Mr.W */ #include "cop.h" void cop_init(void) { cop_config_t configCop = {0}; COP_GetDefaultConfig(&configCop); COP_Init(SIM, &configCop); COP_Refresh(SIM); } void wdg_feed(void) { COP_Refresh(SIM); }
2、.h文件内容
/* * cop.h * * Created on: 2020年8月26日 * Author: Mr.W */ #ifndef COP_H_ #define COP_H_ /*********************************************************************************************************************** * Included files **********************************************************************************************************************/ #include "fsl_cop.h" #if defined(__cplusplus) extern "C" { #endif /* __cplusplus */ /*********************************************************************************************************************** * Definitions **********************************************************************************************************************/ /*********************************************************************************************************************** * Global variables **********************************************************************************************************************/ /*********************************************************************************************************************** * Initialization functions **********************************************************************************************************************/ void cop_init(void); void wdg_feed(void); #if defined(__cplusplus) } #endif #endif /* COP_H_ */
3、需要注意事项
这里一定要不失能看门狗,否则初始化看门狗后不起作用,还有就是在调试模式下内部看门狗是被失能的。
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步