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 for use with MPLAB X IDE.
Here are some sample projects:
- Demo project with PIC24H and NHD-C12864A1Z-FSW-FBW-HTT (128×64, ST7565P chipset)
- Demo project with PIC24H and NHD-C12832A1Z-FSW-FBW-3V3 (128×32, ST7565R chipset)
- Demo project with PIC24H and Nokia 3110 display (PCD8544)
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)
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.
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: