ATTIny2313-16MI ATMEL Corporation, ATTIny2313-16MI Datasheet - Page 42

no-image

ATTIny2313-16MI

Manufacturer Part Number
ATTIny2313-16MI
Description
8-bit AVR Microcontroller with 2K Bytes In-System Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
42
ATtiny2313/V
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.
Note:
Assembly Code Example
C Code Example
WDT_off:
WDR
void WDT_off(void)
{
}
; Clear WDRF in MCUSR
ldi
out
; Write logical one to WDCE and WDE
; Keep old prescaler setting to prevent unintentional Watchdog Reset
in
ori
out
; Turn off WDT
ldi
out
ret
_WDR();
/* Clear WDRF in MCUSR */
MCUSR = 0x00;
/* Write logical one to WDCE and WDE */
WDTCR |= (1<<WDCE) | (1<<WDE);
/* Turn off WDT */
WDTCR = 0x00;
1. The example code assumes that the part specific header file is included.
r16, WDTCR
r16, (1<<WDCE)|(1<<WDE)
WDTCR, r16
r16, (0<<WDE)
WDTCR, r16
r16, (0<<WDRF)
MCUSR, r16
(1)
(1)
2543C–AVR–12/03

Related parts for ATTIny2313-16MI