ATmega88 @ 8MHz 12
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
/* code012.c ATmega88 @ 8MHz */ | |
#include <avr/io.h> | |
uint8_t addiere(uint8_t zahl); // Funktions Prototypen | |
void mult(uint8_t summe); // Funktions Prototypen | |
void ausgabe(uint8_t summe); // Funktions Prototypen | |
uint8_t addiere(uint8_t zahl) | |
{ | |
zahl += 5; | |
return zahl; // Ergebnis zurück geben | |
} | |
void mult(uint8_t summe) | |
{ | |
summe *= 2; | |
ausgabe(summe); // Aufruf der Funktion ausgabe und Übergabe von summe | |
} | |
void ausgabe(uint8_t summe) | |
{ | |
PORTD = summe; // Ausgabe von summe auf PORTD | |
} | |
int main(void) | |
{ | |
DDRD = 0xFF; // PORTD auf Ausgang | |
PORTD = 0x00; // PORTD = Low | |
uint8_t summe = addiere(2); | |
mult(summe); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment