EasyManuals Logo

STMicroelectronics STM8 User Manual

STMicroelectronics STM8
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #70 background imageLoading...
Page #70 background image
Explanation
There’s no way to enable watchdogs manually in software as they are always enabled. However, there
are configuration bits to select if the IWDG and the WWDG are enabled in software or hardware. They
only come in effect when configured. This is cool.
For WWDG, we just need to set the value of the down counter and the window register value only.
void WWDG_setup(void)
{
WWDG_Init(0x7F, 0x60);
}
We need to monitor the WWDG in order to reload it when it is the right time window.
while(TRUE)
{
if((GPIO_ReadInputPin(GPIOB, GPIO_PIN_7) == FALSE) || ((WWDG_GetCounter() > 0x60) && (WWDG_GetCounter() <
0x7F)))
{
WWDG_SetCounter(0x7F);
}
GPIO_WriteReverse(GPIOD, GPIO_PIN_0);
delay_ms(20);
};
Remember too early of too late will reset the micro.
Demo
Video link: https://www.youtube.com/watch?v=a_JWHJCh_-o

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the STMicroelectronics STM8 and is the answer not in the manual?

STMicroelectronics STM8 Specifications

General IconGeneral
BrandSTMicroelectronics
ModelSTM8
CategoryMicrocontrollers
LanguageEnglish

Related product manuals