写了个看门狗程序,可是却不工作,不知何原因,大家指点一二。 /******************************************************************************* * Function Name : IWDG_Configuration * Description : Configures IWDG. * Input : None * Output : None * Return : None * 备注 : 看门狗时长约为800ms *******************************************************************************/ void IWDG_Configuration(uint16 dogtime) { /* IWDG timeout equal to 819 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 counter clock: 40KHz(LSI) / 8 = 5 KHz */ IWDG_SetPrescaler(IWDG_Prescaler_8);
/* Set counter reload value to 0xfff */ IWDG_SetReload(dogtime);
/* Reload IWDG counter */ IWDG_ReloadCounter();
/* Enable IWDG (the LSI oscillator will be enabled by hardware) */ IWDG_Enable(); } |