![Atmel AVR132 Скачать руководство пользователя страница 9](http://html1.mh-extra.com/html/atmel/avr132/avr132_application-note_3003535009.webp)
9
AVR 132 Application Note
2551A–AVR–11/03
Figure 6. Timed Sequences for Changing the WDT Configuration
Implementation
This application note provides three code examples written in C. They are all designed
for the ATtiny13 device placed on the STK500 development board or similar. The ports
PB0 and PB1 are connected to a ready-LED and a failure-LED respectively, and PB2,
PB3 and PB4 are connected to three of the STK500 switches. Note that driving an out-
put low turns on a LED, and pressing a button drives the corresponding input low. The
setup is shown in Figure 7.
Figure 7. Circuit Diagram for Application Example
The examples demonstrate the following concepts:
•
Using the WDT as a system reset source
•
Using the WDT as a Wakeup Timer
•
Using the WDT as a combined Wakeup Timer and system reset source with
parameter backup
Note:
The WDTON fuse must be unprogrammed when running the examples using the WDT
Interrupt Mode.
Disable WDT System Reset
Mode
Disable interrupts
Set Watchdog
Change Enable bit
Clear WDT System
Reset Enable bit within
4 cycles
Enable interrupts
Continue
Change WDT timeout period
Disable interrupts
Set Watchdog
Change Enable bit
Change WDT Prescaler
settings within 4 cycles
Enable interrupts
Continue
ATtiny13
VCC
GND
PB0
PB1
PB2
PB3
PB4
~RESET
Ready
Failure
Command1
Command2
Command3
Reset