/* code016.c ATmega88 @ 8MHz */ #include <avr/io.h> #include <avr/interrupt.h> // Einbinden von interrupt.h (Interrupt Funktionen) #include <avr/wdt.h> // Einbinden von wdt.h (Watchdog Funktionen) uint8_t counter = 100; int main(void) { DDRD = 0xFF; PORTD = 0x00; wdt_reset(); // watchdog timer reset wdt_enable(WDTO_60MS); // watchdog enable, time-out 60ms WDTCSR = (1<<WDIE); sei(); // Interrupts aktivieren asm ("NOP"); // no operation while(1) { while (counter >= 0) { counter --; PORTD = (1<<PD7); // LED D7 ON } wdt_reset(); // watchdog timer reset } } ISR (WDT_vect) // ISR Watchdogtimer Overflow Interrupt { PORTD |= (1<<PD6); // LED D6 ON WDTCSR = (1<<WDIE); // Watchdog Interrupt aktivieren }