I got this display -- old stock from a Sparkfun/Arduino retailer -- the COM-9230
If I had know it was old and had problems.... but that's another story. There is a simple fix for the scrambled display that appears.
In the setup routine I send the Display five blanks as the first "data set". That seems to force out any garbage in buffer and allow the following commands to present data correctly.
/* Arduino sketch for Sparkfun LCD
COM-09230
The display gets scrambled occasionally.
A cure is in the setup routine.
Start the display and sen it five "blanks".
WillR April 01, 2011
Display should be as follows (where the Underscore "_" is a blank.
42__
AbCd
12:34
Hope this helps a few people.
I know they have discontinued this display.
There is nothing fancy here. No incredibly brilliant code here.
Sorry about that!
You DO NOT need that fancy Reset Line trick -- I was going to try that
This simple fix lets me use the [ Vcc, Gnd, Serial line ] three wire cable.
*/
byte myLine1[] = {
0x04, 0x02, 0x78, 0x78, 0x78};
byte myLine2[] = {
0x0A, 0x0B, 0x0C, 0x0D, 0x78};
byte myLine3[] = {
0x01, 0x02, 0x03, 0x04, 0x78};
byte myBlank[] = {
0x78, 0x78, 0x78, 0x78,0x78,0x78};
byte myDotsOff[] = {
0x77, 0x00,0x00,0x00};
byte myColon[] = {
0x77, 0x30,0x00,0x00};
void setup (void){
Serial1.begin(9600);
Serial1.flush();
delay(1000);
/// KEY LINES BELOW -- FIVE BLANKS SENT
for (int i=0; i<5; i++)
{
Serial1.print(myBlank[i]);
}
delay(1000);
for (int i=0; i<2; i++)
{
Serial1.print(myDotsOff[i]);
}
delay(1000);
}
void loop(void) {
for (int i=0; i<2; i++)
{
Serial1.print(myDotsOff[i]);
}
for (int i=0; i<4; i++)
{
Serial1.print(myLine1[i]);
}
delay(2000);
for (int i=0; i<4; i++)
{
Serial1.print(myLine2[i]);
}
delay(2000);
for (int i=0; i<2; i++)
{
Serial1.print(myColon[i]);
}
for (int i=0; i<4; i++)
{
Serial1.print(myLine3[i]);
}
delay(2000);
}
Hope this helps a few people.