Hi.
When writing to a display (2x16) the first character is completeley black i'm writing at at following way.
init select line 1 write to line 1 select line 2 write to line 2
The display is an 44780 compatible. I'm using an atmel 89c51
This is the code i use:
In this function void lcd_writestring (char *string1, char *string2) the writing is done. before this i used puts and getchar but i didn't like that sollution.
/* lcd controller functions --------------------------------------------------------------*/
void lcdusdelay(int delay) { int i; for(i=0; i 4) | 0xF0; Low = (c & 0x0F) | 0xF0;
rs = 1;
P3 &= High; // Write High Nibble e = 1; e = 0; P3 |= 0x0F;
P3 &= Low; // Write Low Nibble e = 1; e = 0; P3 |= 0x0F;
rs = 0;
}/* function for writing the complete display*/ void lcd_writestring (char *string1, char *string2) { int i = 0; int j = 0;
lcdwrite(0x08); lcdwrite(0x00); lcdmsdelay(1);
for (i=0; i!=15; ++i) { printchar(string1[i]); }
lcdwrite(0x0c); lcdwrite(0x00); lcdmsdelay(1);
for (j=0; j!=15; ++j) { printchar(string2[j]); }
}void update_menu(void) { if (up == 1) { up = 0; lcd_writestring("Ma 20:17 ", "up down ent set");
} if (down == 1) { down = 0; lcd_writestring("down is pressed ", "up down set ent"); }
}The black character can be seen on both lines and it is written in stead of the first real character. So the text doesn't move one character ahead.
Yours Bram