Skip to content

Instantly share code, notes, and snippets.

@avr-programmierung
Created May 14, 2019 09:25
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/e4e1d84c680231cd4c2080ac9009db57 to your computer and use it in GitHub Desktop.
Save avr-programmierung/e4e1d84c680231cd4c2080ac9009db57 to your computer and use it in GitHub Desktop.
ATMega88 @ 8MHz
/* code001.c ATMega88 @ 8MHz */
#include <avr/io.h> // Einbinden der Headerdatei avr/io.h
#include <util/delay.h> // Einbinden der Headerdatei util/delay.h
int main(void) // Startpunkt eines C-Programms
{
DDRD |= (1<<PD0); // Richtungsregister PORTD PinD0 (Pin2)auf Ausgang setzen
while(1) // Beginn der Endlosschleife da while(1) immer wahr ist
{
PORTD = (1<<PD0); // Portpin PD0 setzen = HIGH
_delay_ms(500); // 500ms warten
PORTD &= ~(1<<PD0); // Portpin PD0 löschen = LOW
_delay_ms(500); // 500ms warten
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment