HQM1286404 is 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 needed because of several reasons â€“ you can find libraries around the internet to start working in just a few minutes, also several tools can be used to generate character arrays and graphics.
The hardest thing for me was to find correct wiring as datasheet I have was for 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:
You can see that Chip select pins are in reverse order, so if halves of the screen are swapped, then you have to swap wires. At VEE pin should be negative voltage near -4.9V. Potentiometer through VCON pin controls LCD contrast. Reset pin can be connected directly to microcontrollers reset circuit. In my case it is separate. Backlight LED can also be adjusted with another potentiometer â€“ is not included here too.
When the circuit is ready, it is time to give 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 to 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 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 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.
Here is my example which displays simple graphics on LCD: Bitmap dispalay demo program is ready to be compiled with the latest WinAVR and flashed to Atmega8 via avrdude.
Updated code with Markus library fix: GLCD5