You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

#include "wdg.h"
//////////////////////////////////////////////////////////////////////////////////
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>ѧϰʹ<EFBFBD>ã<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>;
//ALIENTEK<EFBFBD><EFBFBD>ӢSTM32<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD>Ź<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>@ALIENTEK
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̳:www.openedv.com
//<EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:2012/9/3
//<EFBFBD><EFBFBD><EFBFBD>V1.0
//<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><EFBFBD><EFBFBD>
//Copyright(C) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾ 2009-2019
//All rights reserved
//////////////////////////////////////////////////////////////////////////////////
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ź<EFBFBD>
//prer:<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>:0~7(ֻ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>Ч!)
//<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>=4*2^prer.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>256!
//rlr:<EFBFBD><EFBFBD>װ<EFBFBD>ؼĴ<EFBFBD><EFBFBD><EFBFBD>ֵ:<EFBFBD><EFBFBD>11λ<EFBFBD><EFBFBD>Ч.
//ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>):Tout=((4*2^prer)*rlr)/40 (ms).
void IWDG_Init(u8 prer,u16 rlr)
{
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); //ʹ<EFBFBD>ܶԼĴ<EFBFBD><EFBFBD><EFBFBD>IWDG_PR<EFBFBD><EFBFBD>IWDG_RLR<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
IWDG_SetPrescaler(prer); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IWDGԤ<EFBFBD><EFBFBD>Ƶֵ:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IWDGԤ<EFBFBD><EFBFBD>ƵֵΪ64
IWDG_SetReload(rlr); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IWDG<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>ֵ
IWDG_ReloadCounter(); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IWDG<EFBFBD><EFBFBD>װ<EFBFBD>ؼĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>IWDG<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
IWDG_Enable(); //ʹ<EFBFBD><EFBFBD>IWDG
}
//ι<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ź<EFBFBD>
void IWDG_Feed(void)
{
IWDG_ReloadCounter();//reload
}