deveopmen
Watchdog Timer
Rev.B2 for proof reading
Mitsubishi Microcomputers
M32C/83 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
106
Watchdog Timer
The watchdog timer has the function of detecting when the program is out of control. The watchdog timer is
a 15-bit counter which down-counts the clock derived by dividing the BCLK using the prescaler. Whether a
watchdog timer interrupt is generated or reset is selected when an underflow occurs in the watchdog timer.
Watchdog timer interrupt is selected when bit 6 (CM06) of the system control register 0 (address 0008
16
) is
"0" and reset is selected when CM06 is "1". No value other than "1" can be written in CM06. Once reset is
selected (CM06="1"), watchdog timer interrupt cannot be selected by software.
When X
IN
is selected for the BCLK, bit 7 (WDC7) of the watchdog timer control register (address 000F
16
)
selects the prescaler division ratio (by 16 or by 128). When X
CIN
is selected as the BCLK, the prescaler is
set for division by 2 regardless of WDC7. Therefore, the watchdog timer cycle can be calculated as follows.
However, errors can arise in the watchdog timer cycle due to the prescaler.
When X
IN
is selected in BCLK
Watchdog timer cycle =
When X
CIN
is selected in BCLK
Watchdog timer cycle =
For example, when BCLK is 20MHz and the prescaler division ratio is set to 16, the monitor timer cycle is
approximately 26.2 ms, and approximately 17.5 ms when BCLK is 30MHz.
The watchdog timer is initialized by writing to the watchdog timer start register (address 000E
16
) and when
a watchdog timer interrupt request is generated. The prescaler is initialized only when the microcomputer is
reset. After a reset is cancelled, the watchdog timer and prescaler are both stopped. The count is started by
writing to the watchdog timer start register (address 000E
16
). CM06 is initialized only at reset. After reset,
watchdog timer interrupt is selected.
The watchdog timer and the prescaler stop in stop mode, wait mode and hold status. After exiting these
modes and status, counting starts from the previous value.
In the stop mode, wait mode and hold state, the watchdog timer and prescaler are stopped. Counting is
resumed from the held value when the modes or state are released. Figure 1.10.1 shows the block diagram
of the watchdog timer. Figure 1.10.2 and 1.10.3 show the watchdog timer-related registers.
"CM06=0"
Watchdog timer
interrupt request
"CM06=1"
Reset
BCLK
Write to the watchdog timer
start register
(address 000E
16
)
RESET
Watchdog timer
Set to
“
7FFF
16
”
1/128
1/16
“
CM07 = 0
”
“
WDC7 = 1
”
“
CM07 = 0
”
“
WDC7 = 0
”
“
CM07 = 1
”
HOLD
1/2
Prescaler
Prescaler division ratio (16 or 128) x watchdog timer count (32768)
BCLK
Prescaler division ratio (2) x watchdog timer count (32768)
BCLK
Figure 1.10.1. Block diagram of watchdog timer