#include "stm8s.h"
uint8_t u8_value;
FlagStatus fs;
本文引用地址:http://www.ex-cimer.com/article/201611/319382.htmvoid main(void)
{
GPIO_DeInit(GPIOD);
GPIO_Init(GPIOD, GPIO_PIN_ALL, GPIO_MODE_OUT_PP_LOW_SLOW);
fs = RST_GetFlagStatus(RST_FLAG_WWDGF);
if(fs != RESET)
{
RST_ClearFlag(RST_FLAG_WWDGF);
GPIO_WriteHigh(GPIOD, GPIO_PIN_0);
}
WWDG_Init(0x7f, 0x60);
while (1)
{
u8_value = WWDG_GetCounter();
if((u8_value & 0x7f) < 0x60)
{
WWDG_SetCounter(0x7f);
}
}
}
評論