Newhaven Display Forum

Newhaven Products => Character LCDs => Topic started by: milhead on April 28, 2014, 12:06:17 AM

Title: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
Post by: milhead on April 28, 2014, 12:06:17 AM
Hello Folks;

I'm using a NHD-0216K3Z-FL-GBW-V3 via SPI and I cannot
get a single character to display...

My clock frequency is around 78Khz, The following
display, show my setting
Display-On (0xfe,0x41),
Set-Contrast (0xfe, 0c52, 0x19), then
Clear-Screen (0xfe, 0x51).. Then
the text for 'Hello'

I cannot get any logical commands to work, LCD back-light etc..

I have soldered a wire across R2 to select SPI...

Does someone have an example of commands needed to initialize the display or am I missing something else...

I have the exact same result with two displays, I suspect
there is something that I am not doing;

Any help would be appreciated!


[attachment deleted by admin]
Title: Re: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
Post by: Michael_L on April 29, 2014, 10:14:25 AM
Have you looked at our serial interface  character LCD example code on our website?  Here is a link to it below: (
You will see that in the example code, the various modes of serial communication are shown.  You will only need to focus on the SPI interface sections of code.
This will show you not only how to write to the display via SPI (timing, protocol) but also how to initialize it correctly.
Title: Re: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
Post by: milhead on April 29, 2014, 06:11:24 PM
Hi Michael

I've changed my code slightly to send the exact same commands with at least the same delays I still get no effect on the display.

In the example code it sets the Black light Brightness to 15 but the documentation says that it's
defined between 1-8.  Do you know what the correct range is?

Code: [Select]
// ...snippet from Newhaven example code....
// Set Backlight Level
tx_packet[1] = 0x53;
tx_packet[2] = 15; // backlight 1 - 15

In my case the back-light is on full (compared to my other parallel Newhaven displays).

Do you know what SPI 'mode' the display requires?

Would it be possible to see a logic analyzer trace of a successful display initialization? 
There are so many SPI variants combined with the emulation of an SPI slave by the
PIC controller.  Seeing a working one would allow me to quickly setup my master to
communicate the same way.

I've tried to back out the SPI pin interactions from the example code without success....

Any help would be appreciated!


Title: OK, Have it working....
Post by: milhead on April 30, 2014, 09:44:11 AM
I got it working.. 

The PIC software does 'not' have a multi-byte transfer capability and requires the
clock be high prior to initiating the clock within a chip select as well as Sampling
on the clock rising edge...  Until I adjusted my master as shown below I had a variety of

In SPI specification terms

   MSB First
   8 Bits per transfer ( No Multi-byte transfers )
   Enable Line is active Low...
   SPI Mode 3 (See
        SPI:CPOL=1  (Clock Polarity, High When Inactive)
        SPI:CPHA=1 (Clock Phase, Data is valid on clock trailing edge)

I'm sure the author of the PIC code knew this stuff but was dropped before the somewhat brief protocol discussion in the external reference. 

Obey the required delay after the various commands as shown in the spec..

I hope this saves somebody some time....


Title: Re: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
Post by: Michael_L on May 06, 2014, 12:07:10 PM
Thank you for sharing your corrections!