*FRUSTRATED!* --> Can't get SerLCD to receive commands!!

I have tried about a million-and-one times to get the commands (clear screen, adjust brightness, move cursor, etc.) to work on my LCD from Sparkfun. It’s model no. LCD-00461 (16x2), and includes the serial ‘backpack’. What am I doing wrong? I can’t get it to work on my Arduino, OR my BS2e (BASIC Stamp). Here’se some example code for the Arduino that does not work (except for the “HELLO” part; I can send text to it easily).

void setup() {
  Serial.begin(9600);                // I have not changed the default value 
                                              // for the bps rate on the LCD
}

void loop()
{
  Serial.print(0x01, BYTE);         // Clear Screen
  delay(15);
  Serial.print(128, BYTE);           // Adjust Brightness
  Serial.print(157, BYTE);           // Brightness Value
  delay(10);
  Serial.print("HELLO");              // Text String 
  delay(10000);                         // Repeat Every 10 Seconds
}

It appears that you need to preface the clear screen with a decimal 254. This holds true for all of the commands listed in the special commands box in the documentation:

Serial.print(0xFE, BYTE);
Serial.print(0x01, BYTE);

YAAAY! :smiley: WHERE did you find, in the documentation, where is says something of the sort (or even indirectly) “precede all commands by the value 255 (0x0FE)”?? A little after I posted this thread, I figured out how to do the commands (well, at least the ones I tested, being move cursor to the right and backlight ++). I simply preceded every command by the ‘special command’ (124). So one example might be:

Serial.print(124, BYTE);

delay(10);

Serial.print(20, BYTE);

The delay, as I found, is necessary for it to work for some reason. This example moves the cursor to the right one.

The weird thing is, the only command that DIDN’T work (out of the three that I tested) was the clear screen command. How come when I put the “Serial.print(0xFE, BYTE);” in front of the clear command, it works, but not when I put the “Serial.print(124, BYTE);” in front??? Thanks for the help.

Wait…Also: How do I set the cursor position? I know it says the command is “0x80 +”, but how do I use that???

I don’t have the serial backpack for these displays, but I looked at the C source code from the SparkFun catalog page. Unfortunately, it is for the 2.0 and not 2.5, so some of the commands are not reflected in the source. It would be nice if SparkFun would post the updated source code as it would help everyone get up to speed easier.

Setting the cursor position requires the sequence $80 and then the position as described in the documentation. No need for a special lead-in:

Serial.print($80, BYTE);
Serial.print($40, BYTE);  // the memory location to go to

Clear screen, home, and the scrolling routines do require a short delay before sending anything else to the board. Although I thought the board used the hardware BUSY line on the LCD which should negate that requirement (as far as the calling program is concerned). Of course version 2.5 could have changed that.

Ok. Thanks. Now do you know the range for the second value (the min. and max. values). Is it just 1-32 or 0-31? ← Those values are decimal form, FYI.

Sorry I don’t know the range off the top of my head, but here is the link to the [datasheet on the site.

BTW, I forgot to mention that the decimal 124 lead-in is another special code that accesses SparkFun added features. So the two lead-in codes are 124 and 254. The information is there, but you have to do a little digging.](http://www.sparkfun.com/datasheets/LCD/HD44780.pdf)

Sparkfun, I love the LCD. But dammit, can’t you better document it :evil:!! Here’s the holy grail on using Sparkfun’s SerLCD’s (I just found the site): http://www.arduino.cc/playground/Learni … kFunSerLCD

quackmaster7000:
Sparkfun, I love the LCD. But dammit, can’t you better document it :evil:!! Here’s the holy grail on using Sparkfun’s SerLCD’s (I just found the site): http://www.arduino.cc/playground/Learni … kFunSerLCD

Thanks QM - that was incredibly helpful. I received my shipment today and have my project completely up and running. The software side of things was made simpler with the reference you provided.

Cheers,

jeff

p.s. For anyone reading this - I’m using v2.5 (which allows you to set the splash screen). When I did that only the first 16 characters on lines 1 & 2 are saved. The last 4 chars are removed.

As to the special characters take a look at page 1 item 2.

http://www.sparkfun.com/datasheets/LCD/SerLCD_V2_5.PDF