Skip to content
Graphic LCD Library - PCD854/ST7565R/NTD75451 for AVR/LPC/PIC/STM32
C C++
Branch: master
Clone or download
Latest commit 99c6db4 Apr 16, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
controllers Minor code clean up Dec 23, 2016
devices Merge branch 'blueboard' Dec 23, 2016
doxygen_pages Documentation update Dec 22, 2016
fonts Unit test for glcdutils font table Dec 22, 2013
.gitattributes Show features in README Apr 16, 2017
.gitignore Adding support for PIC24H + PCD8544 Dec 20, 2013
Doxyfile Update documentation Dec 17, 2013
LICENSE Updated name in license information Jul 6, 2012 Show features in README Apr 16, 2017
glcd.c Support for displaying bitmap images Mar 16, 2013
glcd.h Support code for STM32F10x - not tested to work yet! Dec 23, 2016
glcd_controllers.h Re-arranged some files (still needs more work) Jul 13, 2012
glcd_devices.h Support code for STM32F10x - not tested to work yet! Dec 23, 2016
glcd_graphics.h Changed the way pgmspace buffers are implemented Mar 16, 2013
glcd_graphs.h Seperated some functions out of glcd.h to separate files to make it e… Jul 17, 2012
glcd_text.h Add method for setting different font table types Dec 22, 2013
glcd_text_tiny.h Updated docs, removed some uneeded descriptions Jul 17, 2012
graphics.c Changed the way pgmspace buffers are implemented Mar 16, 2013
graphs.c Changed delay usage in library everywhere to delay_ms() Aug 6, 2012
text.c Improve compatibility with stricter compiling options. Dec 21, 2016
unit_tests.c Rectangle demo doesn't need to hold state for so long Dec 30, 2013
unit_tests.h glcdutils font table now working Dec 22, 2013

glcd - Graphic LCD Library

by Andy Gock

Up to date documentation

For up to date documentation, please see the doxygen pages under the doxygen_pages directory and within the source code.

A online version can also be seen at:

However this site may not always be kept up to date.


Welcome to GLCD, an open source graphic LCD library written by Andy Gock.

Author's web site:

GitHub repository:

This library has been written cleanly, to allow easy modification for use with different microcontroller devices and controller chipsets. Logic relating to devices and controllers are palced in seperate files and specific implementations can be chosen by the use of special defined symbols.

It is suitable for monochrome (black and white) LCDs with page by page data and command write style data transfer protocol. It is not compatible with color graphic LCDs.


  • Draw text, of different sizes, from small 5x7 pixel fonts to large custom characters. Custom fonts can be generated using free MikroElektronika Font Creator software.
  • Can write text from SRAM and Flash memory.
  • Scrolling text.
  • Draw vertical or horizontal bar graphs, with or without borders.
  • Draw circles, lines, rectangles - filled or unfilled.
  • Draw individual pixels in any color (black or white).
  • Display is fully buffered, for a Nokia 5110 display of 84x48 dots, you'll need at least 504 bytes of SRAM to store the frame buffer.
  • It only writes the part of the frame buffer which has changed. It does not re-write the entire buffer to the LCD every frame update.

Supported devices

Controllers and chipsets

Works with:

  • PCD8544 based LCDs, e.g Nokia 3110 and 5110 LCDs
  • ST7565R / ST7565P serial interface
  • NT75451 parallel interface (used on NGX BlueBoards)

The following graphic displays have been physically tested with and confirmed working:

  • NHD-C12864WC-FSW-FBW-3V3-M
  • NHD-C12832A1Z-FSW-FBW-3V3


MCUs supported

  • Atmel AVR 8-bit
  • NXP LPC111x ARM Cortex-M0
  • NXP LPC11Uxx ARM Cortex-M0
  • ST STM32 F0 ARM Cortex-M0
  • ST STM32 F4 ARM Cortex-M4
  • Microchip PIC24H (and probably other 16-bit MCUs)

Development boards tested on (with on-board LCD)

  • NGX BlueBoard LPC11U37 (with on-board NT75451 graphic LCD)

Development boards tested on (without on-board LCD)

  • Microstick II with PIC24H and Nokia 3310/5110 LCD, ST7565R and ST7565P
  • ST Nucleo F401RE

Special note

Not all combinations of microcontroller platform and LCD controllers are supported out of the box. However you can edit the files devices/ and controllers/ and add your desired combination. More information on how to do this can be read in the doxygen documentation.

Setup of symbols for compiler

The following symbols need to be defined for the compiler:

Select microcontroller

Pick microcontroller type (pick one only):


Select LCD controller

Pick LCD controller type (pick one only):


For ST7565P controllers, treat as ST7565R. For most if not all parts here, they behave the same way.

Select SPI or parallel interface

If using a parallel interface LCD (e.g NT75451 on NGX BlueBoard):


When using SPI controllers:


Note the SPI symbol isn't actually checked by the source at the moment, and it is fine if it is not used. It is for forward compatibility only. One day I may decide to check for it.

Initialisation sequence

For the Newhaven displays using ST7565 based controllers listed above which have been tested as working, there are certain initialisation sequences which should be followed, and this may vary from display to display. To force a certain (and tested) initialisation sequence, define one of the following:


If you don't specify a NHD model, ST7565 controller selection will default to GLCD_INIT_NHD_C12864WC_FSW_FBW_3V3_M sequence. This however may change in the future.

Reset time

To set a reset time, used by the glcd_reset() function, set GLCD_RESET_TIME to desired duration in milliseconds.


When using PCD8544 controllers, define a PCD8544_CONTRAST symbol with a 8-bit unsigned integer for the contast value. If this is not defined, a default value will be used.

LCD dimensions

Set GLCD_LCD_WIDTH and GLCD_LCD_HEIGHT to define custom LCD dimensions. If these are not user defined, then a default width and height is used. The default dimensions are 128x64 except for PCD8544 controllers which is 84x48.

Compiler setup

These symbols need to be set in the configuration options of your IDE, usually in the "defined symbols" section, or they can be defined in a makefile as -D options.



Delay Timing

Some operations such as sending a reset pulse, requires the use of a delay timer. The library will refer to a external function called delay_ms(t) where t is the delay required in milliseconds. Please ensure you have this function elsewhere in your program.

AVR devices

If you are using avr-gcc with Atmel devices, you can force the library to use the built-in _delay_ms() function by setting the compiler symbols:


F_CPU must be set to your clock frequency for the above AVR built-in delay routine to work.

Sample applications

  • STM32F0 Discovery with PCD8544 Nokia 5110 LCD - Download Keil MDK project
  • Custom PCB with Atmel ATMEGA2560 and ST7565R Newhaven 128×64 display - Download Atmel Studio 6 project
  • Atmel AT90USBKEY board with PCD8544 Nokia 5110 LCD - Download Atmel Studio 5 project
  • ZERO Z111xP Cortex-M0 LPC1114 board with PCD8544 Nokia 5110 LCD - Download CooCox CoIDE project or watch video
  • NGX LPC11U37 BlueBoard with built in NT75451 parallel chipset LCD - Download Keil MDK project
  • Microstick II development board, with PIC24H and Newhaven ST7565R display NHD-C12864A1Z-FSW-FBW-HTT - Download MPLAB X project or watch video
  • Microstick II development board, with PIC24H and Newhaven ST7565P display NHD-C12832A1Z-FSW-FBW-3V3 - Download MPLAB X project or watch video
  • Microstick II development board, with PIC24H and PCD8544 Nokia 5110 display - Download MPLAB X project
  • Pinguino development board, with PIC32MX440F256H and PCD8544 Nokia 5110 display - Download MPLAB X project (Thanks to Joris Putcuyps)

The code samples above will have the glcd library code already inside it, however I haven’t made any attempt to keep the glcd library updated in the examples so I advise that if you are using the example code, to replace the glcd directory (usually in library/glcd or lib/glcd) with the latest updated code.

Display bitmap images

Bitmap images can be converted into a byte array using LCD Assistant

When using this software, we need to set 8 pixels per byte with vertical byte orientation. Do not include size.


Refer to Doxygen generated pages for detailed documentation. You'll can generate the documentation yourself, simply install Doxygen and load the doxygen file in the root directory of the library and generate the documents in a file format of your choice (HTML, PDF, TEX etc).

There is also an online version.

You can’t perform that action at this time.