Rainbow-electronics ATmega32L Uživatelský manuál Strana 41

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 313
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 40
41
ATmega32(L)
2503C–AVR–10/02
The following code example shows one assembly and one C function for turning off the
WDT. The example assumes that interrupts are controlled (for example by disabling
interrupts globally) so that no interrupts will occur during execution of these functions.
Assembly Code Example
WDT_off:
; Write logical one to WDTOE and WDE
ldi r16, (1<<WDTOE)|(1<<WDE)
out WDTCR, r16
; Turn off WDT
ldi r16, (0<<WDE)
out WDTCR, r16
ret
C Code Example
void WDT_off(void)
{
/* Write logical one to WDTOE and WDE */
WDTCR = (1<<WDTOE) | (1<<WDE);
/* Turn off WDT */
WDTCR = 0x00;
}
Zobrazit stránku 40
1 2 ... 36 37 38 39 40 41 42 43 44 45 46 ... 312 313

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

Žádné komentáře