As I explained in my previous post, back in July I embarked on a journey to try and get a nice new 128×64 pixel graphical LCD display to play nicely with my Arduino projects. I hit some fairly big problems with this, in areas I maybe didn’t expect…
So the basics of talking to the SerialGLCD backpack are quite simple. You just hook it up to the serial transmit pin of the Arduino (pin 2 on an Uno), and then just sent bytes to it. The general form of the commands is to send the byte 0x7C, which means “here starts a command”, and then the command.
Here’s a simple example that draws a little box in the middle of the screen:
Serial.write(0x7C); // command Serial.write(0x0F); // box Serial.write(59); // X1 Serial.write(27); // Y1 Serial.write(69); // X2 Serial.write(37); // Y2 Serial.write(0x01); // Draw
Seems simple enough. But… and there’s always a but, the firmware is broken. So for starters that last parameter (wether to set the rectangle pixels to foreground or background) is totally ignored. But of course, as any non-command text is printed to the display, it’s not really ignored, it’s shown on-screen as garbage.
Another problem, is that if you run a loop or just generally are sending more than one box to the screen, it corrupts. You’ll find extra lines, skipped commands, garbage on the screen, and so on.
The only solution is to accept that the SparkFun firmware is broken, and write your own. Okay, maybe not write your own, that’s tricky stuff. Luckily, a kind individual going by the name of SummoningDark has done this for us, so all we need to do is download his firmware from his SourceForge and burn it onto the backpack using an ISP.