C8051F120/1/2/3/4/5/6/7
170
Rev. 1.2
14.7.2. Disable WDT
Writing 0xDE followed by 0xAD to the WDTCN register disables the WDT. The following code segment illustrates
disabling the WDT:
CLR
EA
; disable all interrupts
MOV
WDTCN,#0DEh
; disable software watchdog timer
MOV
WDTCN,#0ADh
SETB
EA
; re-enable interrupts
The writes of 0xDE and 0xAD must occur within 4 clock cycles of each other, or the disable operation is ignored.
This means that the prefetch engine should be enabled and interrupts should be disabled during this procedure to
avoid any delay between the two writes.
14.7.3. Disable WDT Lockout
Writing 0xFF to WDTCN locks out the disable feature. Once locked out, the disable operation is ignored until the
next system reset. Writing 0xFF does not enable or reset the watchdog timer. Applications always intending to use the
watchdog should write 0xFF to WDTCN in the initialization code.
14.7.4. Setting WDT Interval
WDTCN.[2:0] control the watchdog timeout interval. The interval is given by the following equation:
; where
T
sysclk
is the system clock period.
For a 3 MHz system clock, this provides an interval range of 0.021 ms to 349.5 ms. WDTCN.7 must be logic 0 when
setting this interval. Reading WDTCN returns the programmed interval. WDTCN.[2:0] reads 111b after a system
reset.
4
3
WDTCN
2 0
–
[
]
+
T
sysclk
×
Bits7-0:
WDT Control
Writing 0xA5 both enables and reloads the WDT.
Writing 0xDE followed within 4 system clocks by 0xAD disables the WDT.
Writing 0xFF locks out the disable feature.
Bit4:
Watchdog Status Bit (when Read)
Reading the WDTCN.[4] bit indicates the Watchdog Timer Status.
0: WDT is inactive
1: WDT is active
Bits2-0:
Watchdog Timeout Interval Bits
The WDTCN.[2:0] bits set the Watchdog Timeout Interval. When writing these bits, WDTCN.7 must
be set to 0.
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Reset Value
xxxxx111
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
SFR Address:
SFR Page:
0xFF
All Pages
Figure 14.3. WDTCN: Watchdog Timer Control Register
Summary of Contents for C8051F120
Page 2: ...C8051F120 1 2 3 4 5 6 7 2 Rev 1 2 Notes ...
Page 8: ...C8051F120 1 2 3 4 5 6 7 8 Rev 1 2 26 2 Flash Programming Commands 318 26 3 Debug Support 321 ...
Page 16: ...C8051F120 1 2 3 4 5 6 7 16 Rev 1 2 Notes ...
Page 48: ...C8051F120 1 2 3 4 5 6 7 48 Rev 1 2 ...
Page 98: ...C8051F120 1 2 3 4 5 6 7 98 Rev 1 2 ...
Page 106: ...C8051F120 1 2 3 4 5 6 7 106 Rev 1 2 Notes ...
Page 183: ...C8051F120 1 2 3 4 5 6 7 Rev 1 2 183 Notes ...
Page 184: ...C8051F120 1 2 3 4 5 6 7 184 Rev 1 2 ...
Page 214: ...C8051F120 1 2 3 4 5 6 7 214 Rev 1 2 Notes ...