ATMEGA48V_11 ATMEL [ATMEL Corporation], ATMEGA48V_11 Datasheet - Page 51

no-image

ATMEGA48V_11

Manufacturer Part Number
ATMEGA48V_11
Description
8-bit Atmel Microcontroller with 4/8/16K Bytes In-System Programmable Flash
Manufacturer
ATMEL [ATMEL Corporation]
Datasheet
2545T–AVR–05/11
Note:
Note: If the watchdog is accidentally enabled, for example by a runaway pointer or brown-out
condition, the device will be reset and the watchdog timer will stay enabled. If the code is not set
up to handle the watchdog, this might lead to an eternal loop of time-out resets. To avoid this sit-
uation, the application software should always clear the watchdog system reset flag (WDRF)
and the WDE control bit in the initialisation routine, even if the watchdog is not in use.
Assembly code example
C code example
WDT_off:
void WDT_off(void)
{
}
; Turn off global interrupt
cli
; Reset Watchdog Timer
wdr
; Clear WDRF in MCUSR
in
andi
out
; Write logical one to WDCE and WDE
; Keep old prescaler setting to prevent unintentional time-out
lds r16, WDTCSR
ori
sts WDTCSR, r16
; Turn off WDT
ldi
sts WDTCSR, r16
; Turn on global interrupt
sei
ret
__disable_interrupt();
__watchdog_reset();
/* Clear WDRF in MCUSR */
MCUSR &= ~(1<<WDRF);
/* Write logical one to WDCE and WDE */
/* Keep old prescaler setting to prevent unintentional time-out */
WDTCSR |= (1<<WDCE) | (1<<WDE);
/* Turn off WDT */
WDTCSR = 0x00;
__enable_interrupt();
1.
See ”About code examples” on page 8.
r16, MCUSR
r16, (0xff & (0<<WDRF))
MCUSR, r16
r16, (1<<WDCE) | (1<<WDE)
r16, (0<<WDE)
(1)
(1)
ATmega48/88/168
51

Related parts for ATMEGA48V_11