| 
 
新手上路 
 
	积分32金钱32 注册时间2017-7-11在线时间7 小时 | 
 
1金钱 
| 看门狗初始化,溢出时间是6.4ms #include "iwdg.h"
 void InitIWDG(void)
 {
 IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
 IWDG_SetPrescaler(IWDG_Prescaler_256);               // 40K/256=156HZ(6.4ms)
 IWDG_SetReload(1250);                                           // 1250 = 8s/6.4ms
 IWDG_ReloadCounter();       // Î11·
 IWDG_Enable();
 }
 如果下面的程序中的延时时间为2000ms,来一次喂狗,岂不是还没延时完成就已经看门狗复位了?
 
 void PowerOFFPhone(void)
 {
 GPIO_WriteBit(GPIOB, RestPhone, Bit_RESET);
 SoftDelayms(2000);
 IWDG_ReloadCounter();
 SoftDelayms(2000);
 IWDG_ReloadCounter();
 SoftDelayms(2000);
 IWDG_ReloadCounter();
 SoftDelayms(2000);
 IWDG_ReloadCounter();
 SoftDelayms(2000);
 IWDG_ReloadCounter();
 SoftDelayms(1000);
 IWDG_ReloadCounter();
 GPIO_WriteBit(GPIOB, RestPhone, Bit_SET);
 BKP_WriteBackupRegister(BKP_DR1, 0X0000);    // phone off state
 }
 
 
 
 | 
 |