11
AT89C51RC
1920B–MICRO–11/02
Hardware Watchdog
Timer
(One-time Enabled
with Reset-out)
The WDT is intended as a recovery method in s ituations where the CPU may be sub-
jected to software upsets. T he WDT consists of a 1 3-bit counter and the WatchDog
Timer Rese t (WDTRS T) SFR. The WDT is defaul ted to disable from exiting r eset. To
enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST regis-
ter (SFR location 0A6H). When the WDT is enabled, it will increment every machine
cycle while the oscillator is running. The WDT timeout period is dependent on the exter-
nal cloc k frequency. T here is no way to disa ble the WDT except through reset (e ither
hardware reset or WDT overflow reset). When WDT overflows, it will drive an output
RESET HIGH pulse at the RST pin.
Using the WDT To enabl e the WDT, a user must wr ite 01EH and 0E1H in seque nce to the WDTRST
register (SFR location 0A6H). When the WDT is enabled, the user needs to service it by
writing 01EH and 0E 1H to WDT RST to avo id a WDT ove rflow . The 13-bi t counte r over-
flows when it reaches 8191 (1FFFH), and this will reset the devic e. When the WDT is
enabled, it will increment every machine cycle while the oscillator is running. This means
the user must reset the WDT at least every 8191 machine cycles. To reset the WDT the
user must write 01EH and 0E1H to WDTRST. WDTRST is a write-only register. The
WDT counter cannot be read or written. When WDT overflows, it will generate an output
RESET pulse at the RST pin. The RESET pulse duration is 98xTOSC, where
TOSC =1/FO SC. To ma ke the be st use of the WDT , it sh ould be servic ed in th ose sec-
tions of code that will periodically be executed within the time required to prevent a WDT
reset.
WDT During Power-
down and Idle In Power-down m ode the osc illator stops, whi ch means th e WDT also s tops. While i n
Power-down mode, the user does not need to service the WDT. There are two methods
of exitin g Pow er -down mode: by a h ardwar e r eset or v ia a lev el-ac ti va ted e xte rnal inte r-
rupt which is enabled prior to entering Power-down mode. When Power-down is exited
with hard ware reset , servicing the WDT shou ld occur as it normally does whene ver the
AT89C51 RC i s rese t. E x iti ng Pow er -down with an i nter rupt is s ig nif ican tly di ffe re nt. Th e
interrupt is held low long enough for the oscillator to stabiliz e. When the interrupt is
brough t high, the inter rupt is service d. To prevent the WDT from r esetting the de vice
while the interrupt pin is held low, the WDT is not started until the interrupt is pulled high.
It is su ggested tha t the WD T be rese t during th e inter rupt ser vice for the interrup t used
to exit Power-down mode.
To ensu re that t he WDT doe s not ov erflo w within a few stat es of ex iting Powe r-down, i t
is best to reset the WDT just before entering Power-down mode.
Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is used to determi ne
whether the WDT continues to count if enabled. The WDT keeps counting during IDLE
(WDIDLE bit = 0) as the default state. To prevent the WDT from resetting the
AT89C51 RC whi le in IDLE mode , the us er sh oul d al ways s et up a timer tha t wil l peri od-
ically exit IDLE, service the WDT, and reenter IDLE mode.
With WDIDLE bit enabl ed, the WDT will stop to count in IDLE mode and resumes the
count upon exit from IDLE.
UART The UART in the AT89C51RC operates the same way as the UART in the AT 89C51
and AT89C52. For further information, see the December 1997 Microcontroller Data
Book, page 2-48, section titled, “Serial Interface”.