Skip to content

Instantly share code, notes, and snippets.

@avr-programmierung
Created May 14, 2019 10:07
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/f934083415abfce66c01cc6d715ad264 to your computer and use it in GitHub Desktop.
Save avr-programmierung/f934083415abfce66c01cc6d715ad264 to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz 21
/* code021.c ATmega88 @ 8MHz */
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRD = 0xFF;
PORTD = (1<<PD0); // Bit D0 beim Programmstart einmalig setzen --> 0000 0001
_delay_ms(100); // 100ms warten
while(1)
{
for (uint8_t i=0; i<=6; i++) // for-Schleife für 7 Durchläufe
{
PORTD = (PORTD << 1); // PORTD um 1 Stelle nach links verschieben
_delay_ms(100); // 100ms warten
}
for (uint8_t i=0; i<=6; i++) // for-Schleife für 7 Durchläufe
{
PORTD = (PORTD >> 1); // PORTD um 1 Stelle nach rechts verschieben
_delay_ms(100); // 100ms warten
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment