Serial 20x4 LCD board

Hi, I have a Serial LCD board I can use the example code. But I can't really figure out how to use this in other applications. I am using it with a 20x4 WH2004A-TMI-JT#. Has anyone used this? Thanks

When you ran the sample code, did the text show up on the LCD?

Yes, but when I compare the code to other similar applications it does not make sense to me. Sorry but I am very green when it comes to programming. I have been trying to learn as much as possible. Thanks to all.

What doesn't make sense about their sample program?

Is this the code that you uploaded:

// Serial LCD sample program
// NKC Electronics
void setup()
// Display ON
Serial.print(0xfe, BYTE);
Serial.print(0x41, BYTE);
// Backlight ON
Serial.print(0xfe, BYTE);
Serial.print(0x52, BYTE);
// Home Cursor
Serial.print(0xfe, BYTE);
Serial.print(0x46, BYTE);
// Send some text
Serial.print("NKC Electronics");
// Cursor to column 1, line 2
Serial.print(0xfe, BYTE);
Serial.print(0x45, BYTE);
Serial.print(0x01, BYTE);
Serial.print(0x02, BYTE);
// Send some more text
Serial.print("SerialLCD module");
void loop()

If so, it’s pretty straightforward. You use Serial.print to send data to the LCD’s on-board controller. Some of the data is interpreted by the controller (anything following a 0xfe). There are 1, 2, and 3 byte commands. Some turn the LCD on. Some turn the back-light on. Some position the cursor.

Anything that is not preceded by 0xfe is assumed to be text to be displayed, starting at the current cursor position and proceeding to the end of the row. The text then wraps to the beginning of the next line.

Thanks so much. Maybe I am not even ready to ask questions yet. ;D

"Divide and conquer" is the route to progress.

Put the things you want to do in functions.

Test what you are trying to do a bit at a time. ISOLATE the problem areas.

Often it helps to create substitutes for bits of the project while you get the OTHER bits working. Suppose you were working on an alarm system. At first, just use a push button for the signal from the motion detector. When everything else is working, replace the push button with the real detector. Works? Good! Doesn't work the way it did with the push button? Must be something to do with how the sensor is connected.


Yes, but when I compare the code to other similar applications it does not make sense to me.

Download the Longtech datasheet from the link in your original post. Scroll down to page 7 where the 'Advanced operation commands' start. The first entry in that page is:

Turn On Display
Syntax hexadecimal 0xFE 0x41

Compare that to this code in reply #4:

// Display ON
Serial.print(0xfe, BYTE);
Serial.print(0x41, BYTE);

Does this help?


Yes, Thanks again. I now understand the sample code. :)