GLCD Library Support for PIC24H with ST7565R / ST7565P / PCD8544 (Nokia 3310 5510) LCDs

31 December, 20133 min readElectronics

My graphic LCD library (glcd on GitHub) now supports PIC24H with the ST7565R, ST7565P and PCD8544 LCD controllers.

The code has been tested with the Newhaven display NHD-C12864A1Z-FSW-FBW-HTT and NHD-C12832A1Z-FSW-FBW-3V3. I used a Microstick II development board to test these, with demo code available below. I don’t have any PIC24F chips so I wasn’t able to test it with those chips as well (I think I have lost the chip from the Microstick II package). I would think only minor changes would be needed to make it work with PIC24F.

August 2019 update:

March 2014 update:

  • Now working with Microchip PIC32, with code contributed by Joris Putcuyps. In particular, an example file is provided for the Pinguino development board with the PIC32MX440F256H and a attached Nokia 5110 LCD display.

Sample code

Sample code for use with MPLAB X IDE.

Here are some sample projects:

See other demos on GitHub

Note that the glcd libraries included with the demos above are not kept up to date as further updates are made to the official glcd library. You can update the library by copying the latest glcd distribution into the existing project files. (take note of custom pin configurations, more details below)

Pin configuration

With the projects above, the pin connections to the LCD’s SPI interface are as follows:

  • SDA (serial data input) => RB14
  • SCK (serial clock) => RB15
  • SS / CS (chip select) => RB2
  • A0 (command / data write selection) => RB3
  • RESET => RA2

To add your own custom pin configuration, you can edit the file devices/PIC24H.h. You can also make a custom configuration file by creating a glcd_user_config.h file outside of the glcd directory and defining a new compiler symbol GLCD_USER_CONFIG. Copy the contents of PIC24H.h into it. This way, if you need to  update the library, you can simply overwrite the contents of the existing glcd directory without losing your custom pin configuration. Otherwise, you can just keep track yourself of custom changes made to the *.h files in the devices/ directory.

Videos

Footage of Newhaven Display NHD-C12864A1Z-FSW-FBW-HTT in action, running the sample code:

Footage of Newhaven Display NHD-C12832A1Z-FSW-FBW-3V3 in action, running the sample code:

Other downloads

© Andy Gock 2009−2019