The configuration register of the watchdog timer serves for swithing on and off of the watchdog timer and for the adjustment (preseting) of its operation. The preset value is a number dividing the internal RC clock to obtain, in this case, the clock of the watchdog timer. The watchdog timer is independent of the internal clock which governs the execution of instructions. In this way an operative timer is obtained even if the internal clock fails. The frequency of the RC oscillator for the watchdog timer is 512kHz. After the initial division by 4 one obtains the 128kHz which is the basic clock of the watchdog timer.The basic clock 128kHz of the watchdog timer is divided by two progammable values. The first is prescaler A and the second prescaler B. After division, the internal clock of the watchdog timer is obtained. With this clock an 8-bit register is incremented. When the value in the register reaches the maximum of 255, the watchdog timer resets the microcontroller or switches the microcontroller from inactive to active state. If the microcontroller is in the inactive (SLEEP) state, the watchdog swithes it into the active state and the execution of the current program continues. If the microcontroller is in the active mode, i.e. the execution of the current program is on, the watchdog timer will, upon the expiration of the defined time, reset the micricontroller. The time interval when the wacthdog sends the reset/wake-up signal is calculated as follows. The period of the basic clock is 1/(128 kHz) = 7.8125µs. This value is multiplied by the prescaler A and prescaler B values. This gives the clock period of the watchdog timer. This period multiplied by 255 gives the maximum value the register will be incremented. This value is the time the watchdog timer will wait before it generates the reset/wake-up signal of the microcontroller. The waiting times, in milliseconds, depending on the values of prescaler A and prescaler B, are given in table 2-2.
|PRESCALER B VALUE||PRESCALER A VALUE|
Table 2-2 Waiting times of the watchdog timer
Table 2-3 The configuration register od the watchdog timer FWDT
FWDTEN – Watchdog enable configuration bit 1 – Watchdog enabled; LPRC osillator can not be disabled 0 – Watchdog disabled FWPSA <1:0> - Selected value of prescaler A 11 = 1:512 10 = 1:64 01 = 1:8 00 = 1:1 FWPSB <1:0> - Selected value of prescaler B 1111 = 1:16 1110 = 1:15 .... .... .... 0001 = 1:2 0000 = 1:1