at90pwm81-16se ATMEL Corporation, at90pwm81-16se Datasheet - Page 57

no-image

at90pwm81-16se

Manufacturer Part Number
at90pwm81-16se
Description
8-bit Avr Microcontroller With 8k Bytes In- System Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
7734M–AVR–03/10
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 situation, 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.
The following code example shows one assembly and one C function for changing the time-out value of
the Watchdog Timer.
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. The example code assumes that the part specific header file is included.
r16, MCUSR
r16, (0xff & (0<<WDRF))
MCUSR, r16
r16, (1<<WDCE) | (1<<WDE)
r16, (0<<WDE)
(1)
AT90PWM81
57

Related parts for at90pwm81-16se