TC1796
System Units (Vol. 1 of 2)
Watchdog Timer
User’s Manual
16-6
V2.0, 2007-07
WDT, V2.0
16.4.1
WDT Register Overview
Two control registers, WDT_CON0 and WDT_CON1, and one status register, WDT_SR,
serve for communication of the software with the WDT. This section provides a short
overview and describes the access mechanisms of the WDT registers. Detailed layout
and bit descriptions of the registers are given on
.
Register WDT_CON0 holds the ENDINIT bit, a register lock status bit (WDTLCK), an
8-bit user-definable password field (WDTPW), and the user-definable reload (start)
value (WDTREL) for the WDT in Normal Mode.
Register WDT_CON1 contains two bits. Bit WDTIR is a request bit for the WDT input
frequency selection, while bit WDTDR is a request bit for the Disable Mode of the WDT.
These two bits are only request bits in that they do not actually control the input
frequency and disabling of the WDT. They can be modified only when the ENDINIT bit
is 0, but they will have an effect only when ENDINIT is properly set to 1 again.
The status register WDT_SR holds information about the current conditions of the WDT.
It contains the current timer count value (WDTTIM), three bits indicating the mode of
operation (WDTTO for Time-Out Mode, WDTPR for Prewarning Mode, and WDTDS for
Disable Mode), and the error indication bits for timer overflow (WDTOE) and access
error (WDTAE).
While WDT_SR is a read-only register, the control registers can be read and written.
Reading these registers is always possible; a write access, however, must follow certain
protocols. Register WDT_CON1 is Supervisor Mode and Endinit-protected, thus,
Supervisor Mode must be active and bit ENDINIT must be 0 for a successful write to this
register. If one or both conditions are not met, a bus error will be generated, and the bits
in WDT_CON1 will be not modified.
Register WDT_CON0 requires a much more complex write procedure as it has a special
write-protection mechanism. Proper access to WDT_CON0 always requires two write
accesses in order to modify its contents. The first write access requires a password to
be written to the register to unlock it. This access is called Password Access. Then, the
second access can modify the register’s contents. It is called Modify Access. When the
Modify Access completes, WDT_CON0 is locked again automatically. (Even if no
parameters are changed in the second write access, it is still called a Modify Access.) If
the Modify Access sets ENDINIT = 0, then other protected system registers, such as
WDT_CON1, are unlocked and can be modified.
Note: WDT_CON0 is automatically re-locked after a Modify Access, so a new Password
Access must be performed to modify it again. Note further that the WDT switches
to Time-Out Mode as a side-effect of a successful Password Access, so that
protected registers can remain unlocked at most for the duration of one Time-out
Period. Otherwise, the system will be forced to reset.