The on-chip watchdog counter is intended to force a system reset if the software hangs. This module contains functions for initializing and enabling the watchdog, reloading the watchdog ("kicking the dog") and for reading the current watchdog counter value.
Functions | |
void | hal_wdog_init (uint16_t start_value) |
void | hal_wdog_restart (void) |
void hal_wdog_init | ( | uint16_t | start_value ) |
Function to initialize and enable the watchdog.
start_value | The value to load into the watchdog counter. |
Definition at line 25 of file hal_wdog.c.
void hal_wdog_restart | ( | void | ) |
Function to reload the watchdog. This function reloads the watchdog counter with the parameter given in the hal_wdog_init function.
Definition at line 38 of file hal_wdog.c.
{ uint8_t wd_msb, wd_lsb; #ifdef __C51__ wd_lsb = WDSV; wd_msb = WDSV; WDSV = wd_lsb; // Write the 8 LSB to the WD counter WDSV = wd_msb; // Write the 8 MSB to the WD counter #elif __ICC8051__ wd_lsb = WDSVL; wd_msb = WDSVH; WDSVL = wd_lsb; // Write the 8 LSB to the WD counter WDSVH = wd_msb; // Write the 8 MSB to the WD counter #else #error Please define watchdog restart #endif }