serLCD and arduino

alright so i cannot seem to get this to work...

 

i bought a 2x16 serLCD from sparkfun (this one to be exact: http://www.sparkfun.com/commerce/product_info.php?products_id=9067)

and i just havent been able to get it to display any text at all. I read an arduino tutorial (found here: http://www.arduino.cc/playground/Learning/SparkFunSerLCD) and tried copy/pasting code directly from the page but the only thing that seems to happen is the backlight will step down different levels of brightness. Its been sitting around for about 6 months and now that i finally have time to play around with it I cant seem to get it to work.

I'm pretty sure my setup is right, the serial backpack has 3 screw terminals labeled 5v(which is actually 3.3v), ground, and rx. The 5v is connected to the 3.3v on the arduino (powered via USB) ground is grounded and the RX is connected to the TX on my arduino. I've looked over the datasheet but i dont really understand what i'm reading. I just want to have some sort of basic interfacing where i can, say, push a button and the lcd will display a message. If anyone could help that would be great.

Did you level shift the TX

Did you level shift the TX line?

Not shifted in arduino tutorial

The photo in the second link shows the very same display with RX connected directly to arduino TX, so I doubt level shifting is needed here… perhaps the contrast is off? Maybe you left RX connected while uploading code and it got messed up?

Arduino Sketch

iCon,

  I have the same serial LCD display. I tried several ways to make this work. This sketch worked well for me. The wire connections are printed in the comment at the code beginning. A shorter sketch is farther below it worked also, maybe more to your liking.

 

// ShowText01.pde
// Use TX pin, +5vdc and Gnd for Serial LCD operation.
// Unplug TX Wire before uploading program!!!

// Set this to whatever text you want to print
char line1[] = “Hello”;
char line2[] = “World”;

#define line1Length (sizeof(line1)-1)
#define line2Length (sizeof(line2)-1)

void setup() {
  Serial.begin(9600);
  backlightOn();
  clearLCD();
}

void loop() {
  // write line 1
  for(int i=0;i<line1Length;i++) {
    goTo(i);
    if (line1[i] != ’ ') {
      Serial.print(line1[i]);
    }
    delay(50);
  }
 
  // write line 2
  for(int i=0;i<line2Length;i++) {
    goTo(i+16);
    if (line2[i] != ’ ') {
      Serial.print(line2[i]);
    }
    delay(50);
  }
 
  delay(2000);
  clearLCD();
  delay(1000);
}

// Sets the cursor to the given position
// line 1: 0-15, line 2: 16-31, 31+ defaults back to 0
void goTo(int position) {
  if (position < 16) {
    serCommand();   //command flag
    Serial.print((position+128), BYTE);
  } else if (position < 32) {
    serCommand();   //command flag
    Serial.print((position+48+128), BYTE);
  } else {
    goTo(0);
  }
}

// Resets the display, undoing any scroll and removing all text
void clearLCD() {
   serCommand();
   Serial.print(0x01, BYTE);
}

// Turns the backlight on
void backlightOn() {
    serCommand();
    Serial.print(157, BYTE);
}

// Initiates a function command to the display
void serCommand() {
  Serial.print(0xFE, BYTE);
}

 

This sketch is shorter and may also do what you want:

 

// PrintText.pde
// Use TX pin, +5vdc and Gnd for Serial LCD operation.
// Unplug TX Wire before uploading program!!!

void setup() {
  Serial.begin(9600);
  backlightOn();
  clearLCD();
}

void loop() {
  Serial.print ( “Hello” );  //type in your text
delay(2000);
  clearLCD();
  delay(1000);
}

// Resets the display, undoing any scroll and removing all text
void clearLCD() {
   serCommand();
   Serial.print(0x01, BYTE);
}

// Turns the backlight on
void backlightOn() {
    serCommand();
    Serial.print(157, BYTE);
}

// Initiates a function command to the display
void serCommand() {
  Serial.print(0xFE, BYTE);
}

sorry it’s taken me so long

sorry it’s taken me so long to respond, i was just feeling a bit under the weather and didn’t get a chance to try it out (until now).

i’ll upload a video if necessary however i will also describe what happens:

first off my lcd has already been messed up because i try uploading code with the tx wire plugged in. I’m not sure if the LCD resets each time but assuming it does then all of this happens when i upload the code correctly. When i leave the lcd plugged into the 5v (even though it’s supposed to be 3.3v) i see a brighter backlight, which i think is each character box lighting up instead of the actual backlight. The LCD will display something that looks like this 0ooo0ooo0ooo0. at first it will just display 0ooo0 with a blinking box at the end, then 0ooo0ooo0, and so on, then the display will go blank. im not quite sure what is happening and if it’s too hard to tell from my description i can upload a video.