English
Language : 

DS80C410 Datasheet, PDF (94/102 Pages) Dallas Semiconductor – Network Microcontrollers with Ethernet and CAN
DS80C410/DS80C411 Network Microcontrollers with Ethernet and CAN
Timers
The microcontroller provides four general-purpose timer/counters. Timers 0, 1, and 3 have three common modes of
operation. Each of the three can be used as a 13-bit timer/counter, 16-bit timer/counter, or 8-bit timer/counter with
auto-reload. Timer 0 can also operate as two 8-bit timer/counters. When operated as a counter, timers 0, 1, and 3
count pulses on the corresponding T0, T1, and T3 external pins. Timer 2 is a true 16-bit timer/counter with several
additional operating modes. With a 16-bit reload register, timer 2 supports other features such as 16-bit auto-
reload, capture, up/down count, and output clock generation. All four timer/counters default to the standard
oscillator frequency divided by 12 input clock but can be configured to run from the system clock divided by 4.
Timers 1 and 2 can also be configured to operate with an input clock equal to the system clock divided by 13.
Table 24 shows the SFRs and bits associated with the four timer/counters.
Table 24. Timer/Counter SFRs
TIMER/COUNTER FUNCTION
Timer/Counter Mode Selection and
Control
TIMER/
COUNTER 0
TMOD, TCON
Count Registers
TH0, TL0
8-Bit Reload Register
TH0
16-Bit Reload/Capture Registers
—
Timer Input Clock-Select Bit
Divide-by-13 Clock-Option Bit
CKCON.3
—
TIMER/
COUNTER 1
TMOD, TCON
TH1, TL1
TH1
—
CKCON.4
T2MOD.4
TIMER/
COUNTER 2
T2MOD, T2CON
TH2, TL2
—
RCAP2H, RCAP2L
CKCON.5
T2MOD.3
TIMER/
COUNTER 3
T3CM
TH3, TL3
TH3
—
T3CM.5
—
Watchdog Timer
The watchdog is a free-running, programmable timer that can set a flag, cause an interrupt, and/or reset the
microcontroller if allowed to reach a preselected timeout. It can be restarted by software.
A typical application uses the watchdog timer as a reset source to prevent software from losing control. The
watchdog timer is initialized, selecting the timeout period and enabling the reset and/or interrupt functions. After
enabling the reset function, software must then restart the timer before its expiration or hardware resets the CPU.
In this way, if the code execution goes awry and software does not reset the watchdog as scheduled, the
microcontroller is put in reset, a known good state.
Software can select one of four timeout values as controlled by the WD1 and WD0 bits. Timeout values are precise
since they are a function of the crystal frequency. When the watchdog times out, the watchdog interrupt flag (WDIF
= WDCON.3) is set. If the watchdog interrupt source has been enabled, program execution immediately vectors to
the watchdog timer interrupt-service routine (code address = 63h). To enable the watchdog interrupt source, both
the EWDI (EIE.4) and EA (IE.7) bits must be set. Furthermore, setting the EWT (WDCON.1) bit allows the
watchdog timer to generate a reset exactly 512 system clocks following a timeout. To prevent the watchdog reset
from occurring in such a situation, the watchdog timer count must be reset (RWT = 1) or the watchdog-reset
function itself must be disabled (EWT = 0). Both the enable watchdog timer (EWT) reset and the reset watchdog
timer (RWT) control bits are protected by timed-access circuitry. This prevents errant software from accidentally
clearing or disabling the watchdog. When a watchdog timer reset condition occurs, the watchdog timer reset flag
(WTRF = WDCON.2) is set by the hardware. This flag can then be interrogated following a reset to determine
whether the reset was caused by the watchdog timer.
The watchdog interrupt is useful for systems that do not require a reset circuit. It sets the WDIF (watchdog
interrupt) flag 512 system clocks before setting the reset flag. Software can optionally enable this interrupt source,
which is independent of the watchdog-reset function. The interrupt is commonly used during the debug process to
determine where watchdog reset commands must be located in the application software. The interrupt also can
serve as a convenient time-base generator or can wake up the microcontroller from power-saving modes.
The watchdog timer is controlled by the clock control (CKCON) and the watchdog control (WDCON) SFRs.
CKCON.7 and CKCON.6 are WD1 and WD0 respectively, and they select the watchdog timeout period. Of course,
the 4X/2X (PMR.3) and CD1:0 (PMR.7:6) system clock control bits also affect the timeout period. Table 25 shows
the selection of timeout.
94 of 102