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

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.

Sample code

Sample code for use with MPLAB X IDE.

Here are some sample projects:

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:

Arduino Library for DF Robot 16×2 LCD Keypad Shield

A few years ago, I purchased one of these 16×2 LCD and Keypad Arduino shields. There are quite a few of them around (including some clones?), but they are similar to this one from DF Robot:

IMG_8063I think I bought this one from eBay a few years ago, but nonetheless, the different ones around  are all based on the same circuit. I wrote my own Arduino Library for the keypad operation, and just wanted to share it with those who might find it useful.

There are some jumper wires soldered onto it. This isn’t how it came from the shop, but something I had to modify on the board due to compatibility issues with another shield. I don’t remember exactly what this was for, it was many years ago!

The buttons on the keypad, except for the reset switch, are all connected via a resistor divider to a single analog input pin. You can read what the key state is by reading the analog value at the pin, and comparing it to a set of known expected values.

Download Arduino Library

You can download the library over here:

To install, it simply copy the DFR_LCD_Keypad directory into the libraries directory in your Arduino installation. There is an example sketch to help you get started.

A note about the Pin 10 bug

Just one thing to mention, they all happen to have a flaw in the design, so don’t use pin 10 when using this shield. The library has functions to enable and disable the backlight. But in the design, a flaw exists, that when pin 10 is set to output, and set high, it could cause the IO pin of the MCU (the main Atmel chip) to deliver too much current (over the datasheet’s maximum rating) to the backlight LED. This may cause the over stressing of the MCU and may reduce its life, or maybe even blow it up.

  • To set the backlight on, set pin 10 as input.
  • To set the backlight off, set pin 10 as output, and immediately set output low (never high!)

For more information, there is discussion on the Arduino forums about this.

GLCD 0.4 Released – ST7565R and NT75451 support, Blueboard LPC11U37 demo

Version 0.4 of GLCD Graphic LCD Library has been released. It includes added support for:

  • ST7565R LCD controller with SPI serial interface with AVR8 implementation. This is used in Newhaven Display model NHD-C12864WC-FSW-FBW-3V3-M (the device tested on). It should also be compatible with many of the DOG series of COG LCDs by Electronic Assembly, with many of them using the same chip.
  • NT75451 LCD controller with parallel interface with LPC11UXX implementation. This LCD is used in on NGX BlueBoard LPC11U37, and many of their other boards. Thanks to NGX for supplying a sample of their product.

Download version 0.4 release.

Also available:

  • BlueBoard LPC11U37 sample project demonstrating use of the library. Written for Keil MDK, it should be able to be modified to work in other compilers too, but you may need to replace the startup file.
  • AVR Studio 5.1 project demonstrating ST7565R controller on a ATMEGA1280 custom board.

Numerous bug fixes have been performed.

As usual, you can find the latest bleeding edge code at GitHub.