Created
May 14, 2019 09:59
-
-
Save avr-programmierung/3faf18ea70a928b1807668717e2033c7 to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz 15
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
/* code015.c ATmega88 @ 8MHz */ | |
#include <avr/io.h> | |
uint32_t counter = 100000; | |
int main(void) | |
{ | |
DDRD = 0xFF; | |
PORTD = 0x00; | |
asm ("WDR"); // watchdog reset | |
WDTCSR = (1<<WDCE)|(1<<WDE); // watchdog change enabled | |
WDTCSR = (1<<WDE)|(1<<WDP0)|(1<<WDP1)|(1<<WDP2); // watchdog system reset enabled, | |
// set timeout 2s | |
asm ("NOP"); // no operation | |
while(1) | |
{ | |
while (counter >= 1) | |
{ | |
counter --; | |
PORTD = (1<<PD7); // LED ON | |
} | |
asm ("WDR"); // watchdog reset | |
counter = 100000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment