III PERIPHERAL BLOCK: WATCHDOG TIMER
III-5 WATCHDOG TIMER
Configuration of Watchdog Timer
The Peripheral Block incorporates a watchdog timer function to detect the CPU's crash.
This function is implemented through the use of the
Figure 5.1 shows the block diagram of the watchdog timer.
|
|
|
|
|
| Watchdog timer |
|
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
Clock generator |
|
| Prescaler |
|
|
|
|
|
|
| |
|
|
|
| programmable timer 0 | EWD |
|
|
| NMI | ||
|
|
|
|
|
|
|
|
| |||
|
|
|
|
|
|
|
|
| |||
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
| |
|
|
| Figure 5.1 Watchdog Timer Block Diagram |
|
|
|
Control of Watchdog Timer
Setting the operating clock and NMI generating interval
The watchdog timer is operated by the prescaler's output clock. Therefore, the watchdog timer function cannot be used when the prescaler is inactive.
The NMI is generated every time the
The NMI generating interval is calculated using the following equation:
NMI generating interval = | CR0B + 1 |
| [sec.] | |||
fPSCIN ⋅ | pdr | |||||
|
|
| ||||
fPSCIN: Prescaler input clock frequency [Hz] |
| |||||
pdr: | Prescaler's division ratio set by the P16TS0 register (1/4096, 1/1024, 1/256, 1/64, 1/16, 1/4, 1/2, 1/1) | |||||
CR0B: | Set value of the CR0B register (0 to 65,535) |
|
For details on how to control the prescaler and the
Setting the watchdog timer function
To use the watchdog timer function, enable the NMI that is generated by the comparison B signal from the
To prevent an unwanted NMI from being generated by erroneous writing to EWD, this register is normally
For the
If the watchdog timer function is not to be used, set EWD to "0" and do not change it.
WDT
S1C33L03 FUNCTION PART | EPSON |