Created
May 16, 2019 12:41
-
-
Save avr-programmierung/3c60841cb1cb33e054f93ccbbeb256eb to your computer and use it in GitHub Desktop.
Pointer
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
/* | |
* pointer_01.c | |
*/ | |
#include <avr/io.h> | |
char data; // Datentyp char für Zeichen | |
uint8_t i; | |
void lcd_write(char *t) // *t = Pointer auf übergebenes Zeichen | |
{ | |
for (i=0; i<255; i++) // Max. 255 Zeichen | |
{ | |
if (t[i]==0) // String-Ende (bei Wert = 0)? Dann raus hier ... | |
return; | |
else | |
data = t[i]; // data = ASCII-Code an der Adresse | |
} | |
} | |
int main(void) | |
{ | |
lcd_write("lcd"); // Übergibt zuerst l, dann c und am Ende d | |
lcd_write("b"); // Übergibt b | |
lcd_write("c"); // Übergibt c | |
lcd_write(""); // Übergibt einen Leerstring (Stringende) = 0 | |
while (1) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment