Created
May 14, 2019 10:00
-
-
Save avr-programmierung/6f27518fc4879ee08200cddd8e02fb6f to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz 16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment