English
Language : 

ATMEGA329V_0611 Datasheet, PDF (47/375 Pages) ATMEL Corporation – 8-bit Microcontroller with In-System Programmable Flash
2552H–AVR–11/06
ATmega329/3290/649/6490
Table 21. Watchdog Timer Prescale Select
WDP2
0
0
0
0
1
1
1
1
WDP1
0
0
1
1
0
0
1
1
WDP0
0
1
0
1
0
1
0
1
Number of WDT
Oscillator Cycles
16K cycles
32K cycles
64K cycles
128K cycles
256K cycles
512K cycles
1,024K cycles
2,048K cycles
Typical Time-out
at VCC = 3.0V
17.1 ms
34.3 ms
68.5 ms
0.14 s
0.27 s
0.55 s
1.1 s
2.2 s
Typical Time-out
at VCC = 5.0V
16.3 ms
32.5 ms
65 ms
0.13 s
0.26 s
0.52 s
1.0 s
2.1 s
The following code example shows one assembly and one C function for turning off the
WDT. The example assumes that interrupts are controlled (e.g. by disabling interrupts
globally) so that no interrupts will occur during execution of these functions.
Assembly Code Example(1)
WDT_off:
; Reset WDT
wdr
; Write logical one to WDCE and WDE
in r16, WDTCR
ori r16, (1<<WDCE)|(1<<WDE)
out WDTCR, r16
; Turn off WDT
ldi r16, (0<<WDE)
out WDTCR, r16
ret
C Code Example(1)
void WDT_off(void)
{
/* Reset WDT */
__watchdog_reset();
/* Write logical one to WDCE and WDE */
WDTCR |= (1<<WDCE) | (1<<WDE);
/* Turn off WDT */
WDTCR = 0x00;
}
Note: 1. See “About Code Examples” on page 8.
47