Go Down

Topic: GLCD library for ST7920 (Read 5466 times) previous topic - next topic


I have a couple Graphic LCD displays.  They both use the ST7920.  They are great little displays that require a few pins to communicate serially.

When looking for a library I found the GLCD library for the KS0108 (http://www.arduino.cc/playground/uploads/Code/ks0108GLCD.zip).  It appears to be a very good  mature library with many features.  I have watch some of the demos on YouTube.  There is lots of animation, partitioning of the display, and games.

The problem is that it does not appear to support my chip.  I found another library for the ST7920 (http://www.arduino.cc/playground/uploads/Code/LCD12864.zip) but it seems weak.  It also requires most (1K) of my working memory.  In fairness, I don't know how much RAM the KS0108 library requires.

Before I start writing my own library, does anyone know of an existing, efficient full featured library?



I have a ST7920 based NHD display. I have added support for it to u8glib: http://code.google.com/p/u8glib/



With respect the ks0108/glcd library. It uses very little ram as it does not use a frame buffer by default.
The biggest drawback is that it's method of rendering requires reading display memory.
On devices that allow reading the LCD frame buffer directly from the LCD,
no frame buffer is needed in the library. For devices that do not allow reading the lcd frame buffer,
a frame buffer must be allocated in the library. (will be 1k on for 128x64 display).
The reason for needing to read the frame buffer memory is to allow particular types of rendering.
Things like overstrike, drawing graphics on top of text, or scrolling text,
require the ability to read and manipulate the existing buffer contents.

Currently the glcd library does not support the ST7920. The main issue is that the library
is somewhat hard coded to use a particular lcd memory to pixel mapping and the ST7920 uses
a different pixel mapping.
Because of this, the ST7920 is not an easy drop in into the existing glcd library code.

At some point I may add support for it, but it will take a major redesign of  the library's
rendering code. At this point other things are higher priority.

Oliver's library uses a hybrid rendering design that allocates a partial frame buffer.
This allows it to run on displays without requiring read access to the full displays memory.
While this design allows it work on a lcd regardless of how pixels are mapped to the display
it does work differently and will have different capabilities than the glcd library.

Nothing in life is free. There are always trade-offs.

For a library with ST7920 support and good features, I'd recommend using Oliver's library.

--- bill

Go Up