项目应用过程中进行以下初始化IWDG后,进入HALT模式,其Option bytes选其Independant Watchdog is stopped in HATL/ACTHAL mode ,单片机(STM8L151K4T6)老是自动复位,敬请各位帮忙看一下,谢谢! -------------------------IWDG初始化---------------------- /* Enable IWDG (the LSI oscillator will be enabled by hardware) */ IWDG_Enable(); /* IWDG timeout equal to 214 ms (the timeout may varies due to LSI frequency dispersion) */ /* Enable write access to IWDG_PR and IWDG_RLR registers */ IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); /* IWDG configuration: IWDG is clocked by LSI = 38KHz */ IWDG_SetPrescaler(IWDG_Prescaler_128); /* IWDG timeout equal to 214.7 ms (the timeout may varies due to LSI frequency dispersion) */ /* IWDG timeout = (RELOAD_VALUE + 1) * Prescaler / LSI = (254 + 1) * 128 / 38 000 = 858.9 ms */ IWDG_SetReload((uint8_t)RELOAD_VALUE); //RELOAD_VALUE=254 /* Reload IWDG counter */ IWDG_ReloadCounter(); ----------------------主函数-------------------------------------- void main(void) { ............. while(1) { #ifdef IWDG_ENABLE IWDG_ReloadCounter(); #endif BoardScanKey(); __wait_for_interrupt(); } } 麻烦各位帮忙看一下,谢谢! |