Question

I've got an LCD display which I'm trying to interface with an arduino. It uses SPI as its communication interface and there's an application note detailing the code to communicate with it. My problem is that I do not know how to transcribe the code from the app note to the C-based language of processing/Arduino.

Is this a simple task that someone can help me with? I just need to be able to write two lines of text to this screen, nothing more.

datasheet: http://www.newhavendisplay.com/specs/NHD-C0216CZ-FSW-FBW-3V3.pdf

app note: http://www.newhavendisplay.com/app_notes/NHD-C0216CZ.txt

Thank you

Additional Notes: The LCD screen has a ST7032 equivalent controller. I tried google for Arduino libraries for this controller but came up short

Was it helpful?

Solution

Is this a simple task...

No.

that someone can help me with?

The following may help you understand the sample and allow you to succeed. For some embedded systems, variables are directly coupled to IO pins. So these lines of code in the sample:

RST = 0;
SCL = 1;

appear to do nothing. But the variables are coupled to the IO pins, so that code is just bit banging to the LCD screen. They have named the variables the same as the pins on their schematic. On Arduino, all those lines that look like variable assignment ( _=0 _=1 ) would be replaced with writes:

digitalWrite(pinRst, 0); 
digitalWrite(pinScl, 1);

The interface to the LCD is a 3 wire serial interface with chip select, clock and data -- that aspect is fairly common. The RST pin is just to power up in a clean state. The RS pin is somewhat unique -- it selects whether what you are sending over the 3 wire interface is a command, or data.

That should get you started on translation. I will caution that developing such hardware interface code without an oscilloscope or a logic analyzer is going to be painful. The LCD will likely do nothing if the code has the smallest error. There won't be an error message or any useful feedback :( With no instrumentation, you will just have to stare at your code and trace what it is doing in your head. If you get it to work, victory - post on github!

Once you succeed, look into the Arduino SPI library. This device is not a standard 4 wire serial device as it uses the same wire to write data and read data. If you only write to the LCD, you might be able to use the SPI class to replace the bit manipulation code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top