3.3 Watchdog Timer Control Register

Name: WDTCR
Offset: -
Reset: 0x00
Property: -

Bit 76543210 
    WDTOEWDEWDP[2:0] 
Access R/WR/WR/WR/WR/W 
Reset 00000 

Bit 4 – WDTOE Watchdog Turn-off Enable

Set this bit when the WDE bit is written to logic zero. Otherwise, the Watchdog will not be disabled. Once written to one, hardware will clear this bit after four clock cycles. Refer to the description of the WDE bit for a Watchdog disable procedure.

Bit 3 – WDE Watchdog Enable

When the WDE is written to logic one, the Watchdog Timer is enabled, and if the WDE is written to logic zero, the Watchdog Timer function is disabled. WDE can only be cleared if the WDTOE bit has logic level one. Follow this procedure to disable an enabled Watchdog Timer:
  1. In the same operation, write a logic one to WDTOE and WDE. Write a logic one to WDE even though it is set to one before the disable operation starts.
  2. Within the following four clock cycles, write a logic 0 to WDE, which disables the Watchdog.

Bits 2:0 – WDP[2:0] Watchdog Timer Prescaler

The WDP2, WDP1, and WDP0 bits determine the Watchdog Timer prescaling when the Watchdog Timer is enabled. The table below shows the different prescaling values and their corresponding Timeout Periods.

Table 3-1. Watchdog Timer Prescale Select
WDP2WDP1WDP0Number of WDT Oscillator CyclesTypical Time-Out at VCC = 3.0VTypical Time-Out at VCC = 5.0V
00016K (16,384)14 ms13 ms
00132K (32,768)28 ms26 ms
01064K (65,536)56 ms52 ms
011128K (131,072)0.11s0.10s
100256K (262,144)0.22s0.21s
101512K (524,288)0.45s0.42s
1101,024K (1,048,576)0.89s0.84s
1112,048K (2,097,152)1.8s1.7s

The following code example shows one assembly and one C function for turning off the WDT. It assumes that interrupts are controlled (e.g, by disabling interrupts globally) so that no interrupts will occur during the execution of these functions.

Assembly Code Example
WDT_off:
    ; reset WDT
    wdr
    ; Write logical one to WDTOE and WDE
    in r16, WDTCR
    ori r16, (1<<WDTOE)|(1<<WDE)
    out WDTCR, r16
    ; Turn off WDT
    ldi r16, (0<<WDE)
    out WDTCR, r16
    ret
C Code Example
void WDT_off(void)
{
    /* reset WDT */
    _WDR();
    /* Write logical one to WDTOE and WDE */
    WDTCR |= (1<<WDTOE) | (1<<WDE);
    /* Turn off WDT */
    WDTCR = 0x00;
}