Rainbow-electronics ATmega162V Uživatelský manuál Strana 54

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 323
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 53
54
ATmega162/V
2513E–AVR–09/03
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
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
void WDT_off(void)
{
/* Reset WDT*/
_WDR()
/* Write logical one to WDCE and WDE */
WDTCR |= (1<<WDCE) | (1<<WDE);
/* Turn off WDT */
WDTCR = 0x00;
}
Zobrazit stránku 53
1 2 ... 49 50 51 52 53 54 55 56 57 58 59 ... 322 323

Komentáře k této Příručce

Žádné komentáře