I2C LCD on NHD-0420D3Z with PIC16F690 controller

Hello, I just need help creating a code to initialize and display text via I2C communication on a NHD-0420D3Z-NSW-BBW-V3 which uses a PIC16F690 controller. I cant really find any useful information online with example code. I also cannot use any prebuilt libraries as they assume a different controller. I just want to see how the program works and how I would display something on each character line of the LCD. Something like:
"Hello World 1"
"Hello World 2"
...

NHD-0420D3Z-NSW-BBW-V3.pdf (newhavendisplay.com)

Thanks!

It looks as if Newhaven have an example code
https://support.newhavendisplay.com/hc/en-us/articles/5902187111191-Serial-Interface-LCD-with-Arduino

But it seems to have a few errors. e.g. missing include filenames

This form of "backpack" means that you can use I2C, SPI, UART.
It simply prints regular ascii text. And uses an 0xFE "escape character" to send a command.

I am not aware of a specific Arduino library for this style.
But you will do things like:

Wire.beginTransmissdion();
Wire.write((char)0xFE); //escape
Wire.write((char)0x45); //cursor
Wire.write((char)0x05); //line #1, column 5
Wire.write("Hello World");
Wire.endTransmission();

Quite honestly, you are better off with a standard 20x4 with a PCF8574 backpack. This is supported by Arduino libraries.

David.

Edit. Just compiled the Newhaven example code.

  1. just remove the empty include statements
  2. edit line #83 in setup() to enable I2C
  3. comment line #84 to disable SPI
  4. connect SDA, SCL pins on your display to digital#4 and digital#5 (not the HW I2C pins)

Build and run the example.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.