HQM1286404 is a pretty old graphical LCD module, but it is still popular. KS0108 driver controls this LCD. LCD backlight color is yellow-green. I think this is an excellent choice for many projects where graphical information is needed for several reasons – you can find libraries around the internet to start working in just a few minutes. Several tools can also be used to generate character arrays and graphics.
The hardest thing for me was to find the correct wiring as the datasheet I have was for the next PCB revision (HQM1286405) as mine are HQM1286404, so don’t be mistaken as I did. Here is the correct pin-out of LCD:
18 Vee out
19 LED Anode
20 LED Kathode
And circuit part how it is connected to my Atmega8:
Chip select pins are in reverse order, so if halves of the screen are swapped, you have to swap wires. At VEE pin should be negative voltage near -4.9V. Potentiometer through VCON pin controls LCD contrast. The reset pin can be connected directly to the microcontrollers reset circuit. In my case, it is separate. The backlight LED can also be adjusted with another potentiometer is omitted here too.
When the circuit is ready, it is time to give it a try. For this, I recommend downloading the KS0108 Library, which can be found on the internet. I tried several, and only one was working correctly. Without digging too deep, use it for now. The library is written pretty some time ago by Fabian Maximilian Thiele. As his site link is dead, you can download it from here: KS0108 Library.
The good thing with this library is that it is easy to add new characters. Just download GLCDFontCreator2, and with this java program, you can fetch fonts from your windows system and automatically convert them to character arrays and save them in .h format ready to include in to project. Simple examples you will find in the library. I added a simple bitmap display function to it, which allows displaying 128×64 graphics. I convert BMP files to character arrays with the fastlcd.zip program. This program exports to .bas file, but it is easy to change to c compatible data – open generated file with notepad and select replace &h to 0x; then you can copy array data to c program.
Updated code with Markus library fix: GLCD5