I am programming a C8051F500 (from Silicon Labs) with the OLED character display mentioned above. I am using a parallel interface as described on page 11 of the data sheet. For the most part I have it working and even wrote a small library. I then received a second display all wired correctly like the first, plugged it in and found that all the characters would now being displayed twice.
After some debugging I noticed a few things that I did not understand.
1. In the writeOledData routine I ended up commenting out the LCD_RW = 1 to stop the duplicates from occurring. Why would this make fix the problem?
And now any character over 0x7F completely overwites the display with some character above 0x7F. Often it is a 0xB9 but after it is written, its a lot of work to get it back to normal. Loading code or power cyccling don't help. It's stuck in this bad display state?

2. In order to display the character on the display I use the toggle_E() which just performs a LCD_E = ~LCD_E
If I try to use implicit calls LCD_E = 1 followed by LCD_E =0 around the P4=cmd statement (see below), (or vicaversa) something strange happens like the 2nd and 4th line never get displayed.
3. Lastly, Once I get all bad characters as I mentioned above in 1, I can load from a debugger (IDE) a previously working hex and it won't matter. It still remains bad even after I power off and back on.
It would help to look at working example that uses a parallel interface. All the examples I have seen use serial. Below is the code for my data write.
Thanks
void writeOledData(U8 cmd)
{
U8 checkBusy;
U8 eValue;
// write data
LCD_RS = 1;
LCD_RW = 0;
toggle_E();
P4 = cmd;
toggle_E();
spinLock(1, ONE_MS_RELOAD); // Spin 1ms or so
// check for busy
//LCD_RW = 1; // causes double characters
//LCD_RS = 0; // does nothing
// As long as I write a character that has a value 0x7F or less
// CheckBusy is always returns high bit not set
checkBusy = P4;
while (checkBusy & 0x80) {
spinLock(1, ONE_MS_RELOAD); // Spin 1ms or so
checkBusy = P4;
eValue++;
if ( eValue >= 10) {
toggle_E(); // This actually runs with characters higher than 0x7F and sometimes works
}
}
}