Specifications

Appendix C – LCD interface source code
/*
* MP3 player with network interface.
* The Ethernut LCD code
* Engineering Thesis 2002
* by Michael Somersmith
*/
/*
* Print screen
* prints the passed "text"
* prints character to every position on the LCD
*/
void print_screen(char *text)
{
char counter = 0;
char space_counter = 0;
char *temp;
char line = 0;
gotoxy(0,0);
/* loop until at the end of the string */
while ( *text != '\0'){
/* print the character to the LCD */
putch(*text);
text++;
counter++;
/* if past the end of the LCD goto next line */
if ((counter >= NO_COL) && (line == 0)){
line++;
counter = 0;
gotoxy(1,0);
/* if at a space check to see if word will fit on the line */
} else if (*text == ' ') {
space_counter = counter;
temp = text;
temp++;
while((*temp != ' ') && (*temp != '\0')){
space_counter++;
temp++;
}
/* if doesn't fit clear the rest of the line and goto the next */
if ((space_counter >= NO_COL) && (line == 0)){
while(counter < NO_COL){
counter++;
putch(' ');
}
line++;
counter = 0;
gotoxy(1,0);
text++;
}
}
89