Skip to content

Instantly share code, notes, and snippets.

@avr-programmierung
Created May 14, 2019 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avr-programmierung/3faf18ea70a928b1807668717e2033c7 to your computer and use it in GitHub Desktop.
Save avr-programmierung/3faf18ea70a928b1807668717e2033c7 to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz 15
/* 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