Pages: [1]   Go Down
Author Topic: Serial 20x4 LCD board  (Read 1187 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I have a Serial LCD board http://www.nkcelectronics.com/serial-20x4-lcd-bo204.html  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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What doesn't make sense about their sample program?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is this the code that you uploaded:

Code:
// Serial LCD sample program
// NKC Electronics
void setup()
{
Serial.begin(9600);
// 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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4110
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

squartochi:

Quote
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?

Don
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, Thanks again. I now understand the sample code. smiley
Logged

Pages: [1]   Go Up
Jump to: