![](http://datasheet.mmic.net.cn/120000/MC68328PV_datasheet_3559354/MC68328PV_120.png)
Timers
MOTOROLA
MC68328 USER’S MANUAL 12/9/97
10-3
TIMERS
10
PRELIMINARY
10.3 SOFTWARE WATCHDOG TIMER OPERATION
The software watchdog timer protects against system failures by enabling you to escape
from unexpected input conditions, external events, or programming errors. This dedicated
16-bit timer serves as the software watchdog timer.
You can program the watchdog compare register (WRR) with the timeout value. The
watchdog counter will start counting from 0 until it reaches this timeout value. If your
software does not clear the counter before it reaches the timeout, the timer assumes that a
system failure has occurred and the software watchdog logic initiates either a soft reset of
the chip or a maskable interrupt to the CPU, depending on the FI bit in the WRR. Therefore,
once the software watchdog timer is enabled, your software must clear the software
watchdog timer periodically so that it never reaches its timeout value. The maskable
interrupt generated is cleared by clearing the watchdog counter.
The software watchdog timer uses the 32kHz clock as the input to its prescaler module. The
prescaler circuitry divides the clock input by a fixed value of eight. The output of this
prescaler circuitry is connected to the input of a 16-bit counter. The reference/compare
register is a 16-bit programmable register that can be programmed with a maximum value
of 65535 (or 0xFFFF in hex).
10.4 SIGNALS
The following signals are multiplexed with the Port G I/O signals. See Section 7 Parallel
Ports for more information about enabling the timers.
TIN1/PG6 and TIN2/PG4—This pin is the input to the timer and can be used in capture
mode to latch the contents of the free-running counter. It can also serve as the source
of the clock to the prescaler.
TOUT1/PG5 and TOUT2/PG3—This pin is the output of the timer and can be
programmed to toggle or pulse when a “compare” event occurs.
Note: At reset, the watchdog timer is enabled by default when the WDEN bit is set in
the watchdog control and status register (WCSR). Depending on your
application, if you do not need the watchdog timer, you should turn it off in the
system boot-up code. It is recommended that you turn the software watchdog
timer off before you put the processor in sleep or doze because the watchdog
timer will continue to run in these modes. The value of the software watchdog
timer counter can be read at any time.