Rainbow-electronics ATmega8515L Manuel d'utilisateur Page 49

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 223
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 48
49
ATmega8515(L)
2512A–AVR–04/02
1. Inthe same operation,write a logic one to WDCE andWDE.Alogic one must be
written to WDE even though it isset to one beforethe disableoperation starts.
2. Within thenext fourclock cycles, write a logic 0toWDE.Thisdisables the
Watchdog.
In safetylevel 2, it is not possibletodisablethe Watchdog Timer, even with thealgo-
rithm described above. See “TimedSequencesforChanging the Configuration of the
Watchdog Timer”onpage 50.
Bits 2..0 – WDP2, WDP1, WDP0: Watchdog Timer Prescaler 2, 1, and 0
The WDP2,WDP1, andWDP0 bitsdetermine the Watchdog Timerprescaling when the
Watchdog Timer is enabled.The different prescaling values and theircorresponding
Timeout Periods are showninTable21.
The following codeexample shows one assembly and one Cfunction for turning off the
WDT. Theexampleassumes that interrupts are controlled(e.g.,bydisabling interrupts
globally) sothat no interruptswill occurduring execution of these functions.
Table 21. Watchdog Timer Prescale Select
WDP2 WDP1 WDP0
Number of WDT
Oscillator Cycles
Typical Time-out
at V
CC
= 3.0V
Typical Time-out
at V
CC
= 5.0V
000 16K (16,384) 17.1 ms 16.3 ms
001 32K(32,768)34.3 ms32.5 ms
010 64K(65,536) 68.5 ms65ms
011128K(131,072) 0.14 s 0.13s
100256K (262,144) 0.27s 0.26s
101512K(524,288) 0.55 s 0.52 s
1101,024K(1,048,576) 1.1 s 1.0 s
1112,048K(2,097,152) 2.2 s 2.1 s
Assembly Code Example
WDT_off:
; Write logical one to WDCE and WDE
ldi r16, (1<<WDCE)|(1<<WDE)
out WDTCR, r16
; Turn off WDT
ldi r16, (0<<WDE)
out WDTCR, r16
ret
CCode Example
void WDT_off(void)
{
/*
Write logical one to WDCE and WDE
*/
WDTCR = (1<<WDCE) | (1<<WDE);
/* Turn off WDT */
WDTCR = 0x00;
}
Vue de la page 48
1 2 ... 44 45 46 47 48 49 50 51 52 53 54 ... 222 223

Commentaires sur ces manuels

Pas de commentaire