help with sparkfun LCD

I just got my lcd and im pretty excited. i tried connecting it to my parallax rfid reader through the SOUT command and now when i turn on my lcd it has 2 squares filled in automatically. It stills has the sparkfun fun message but then it shows the 2 bricks. I uploaded some code from here http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1196278025/11 and when i type a number in the serial monitor it transmits to the lcd but it always skips a space and puts a brick in between the numbers. any help here?

any one?

come on people

Are you connecting the RF reader directly to the LCD?

Even if it’s the serial LCD, I doubt they’d have compatable control protocols since at the very least you’d need to configure the LCD.

You will have to connect both devices to a controller like an Arduino and have appropriate software on the controller.

in make magazine i think issue 5, it shows you how to connect a serial lcd to a rfid reader and it will display the rfid tag code without a microcointroller so i tried that to test out the lcd and it just spit out a bunch of Xs an blocks. then when i went to put somecode into the arduino and try it on there it would output but eac charcter had a filled in block inbetween it. what should i do?

Can you post the code you used? I’m guessing a carriage return/line feed is getting sent and my be giving you the block.

int val[10];               // variable used to store data from serial port
int ByteCount = 0;

void setup() {
  Serial.begin(9600);         // connect to the serial port
  Serial.println("Arduio Online");
}

void loop() {
  if (Serial.available() > 0) {
    delay(100);
    while (Serial.available() > 0) {
      ByteCount ++;
      val[ByteCount] = Serial.read();
    }
  }
  
  if (ByteCount > 0) {
    for (int i = 1; i <= ByteCount; i++) {
      if (val[i] >= '0' && val[i] <= '9' ) {
        val[i]= val[i] - '0';
        Serial.print(val[i]);
      }
    }
    Serial.println();
    ByteCount = 0;
  }
}

[/quote]

Maybe if you try it like this:

int val[10];               // variable used to store data from serial port
int ByteCount = 0;

void setup() {
  Serial.begin(9600);         // connect to the serial port
  //Serial.println("Arduio Online");
}

void loop() {
  if (Serial.available() > 0) {
    delay(100);
    while (Serial.available() > 0) {
      ByteCount ++;
      val[ByteCount] = Serial.read();
    }
  }
  
  if (ByteCount > 0) {
    for (int i = 1; i <= ByteCount; i++) {
      if (val[i] >= '0' && val[i] <= '9' ) {
        val[i]= val[i] - '0';
        Serial.print(val[i]);
      }
    }
    //Serial.println();
    ByteCount = 0;
  }
}

You’ll have to look at the lcd document to see what to send for line clears and other handling. This will just overwrite the existing number.

thank you so much
i got the code working now ;D
but how do i send special characters, such as clear screen and moving the cursor, to the lcd like in the data sheet?

At a glance, clear screen should be something like:

int val[10];               // variable used to store data from serial port
int ByteCount = 0;

void setup() {
  Serial.begin(9600);         // connect to the serial port
  //Serial.println("Arduio Online");
}

void loop() {
  if (Serial.available() > 0) {
    delay(100);
    while (Serial.available() > 0) {
      ByteCount ++;
      val[ByteCount] = Serial.read();
    }
  }
  
  if (ByteCount > 0) {
    Serial.print(1, HEX);
    for (int i = 1; i <= ByteCount; i++) {
      if (val[i] >= '0' && val[i] <= '9' ) {
        val[i]= val[i] - '0';
        Serial.print(val[i]);
      }
    }
    //Serial.println();
    ByteCount = 0;
  }
}

If that works, you should be able to figure the others out.

it didnt work

Try this, it should work just fine and you should be able to figure out how to execute other special characters by looking at this code. Use this as a function and just call the function whenever you need to.

void clearLCD(){
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(0x01, BYTE);   //clear command.
}

PS:: This is not my original code. I took a snippet from a post by EvilSpeeder.

can someone please post how to implement the clear function into the code that Im currently running from my previous post?
i have tried and failed many times

Just put the “clear function” in your code before the loop. This will tell Arduino what to do when you ‘call’ clearLCD. Then wherever in your code you want to clear the screen, just put:

clearLCD();

The display will clear, the position of the ‘cursor’ will be back to the beginning and your code will continue to run right after that point.

?? When do you want to clear your screen??

can i make it clear when i enter “clear”?

If you have already declared the clearLCD() function before your main code then to clear the LCD all you should have to do is type clearLCD();

If you want to be able to just write clear() then rename your function.

but what code do i write to make it so when i enter "clear"in the serial box it clears the screen?

heres my code and it only displays what i put in the serial box onto the lcd

int val[10];               // variable used to store data from serial port
int ByteCount = 0;
int clearVal;

void setup() {
  Serial.begin(9600);         // connect to the serial port
}

void clearLCD(){
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(0x01, BYTE);   //clear command.
} 


void loop() {
    
  if(Serial.available() ){
    clearVal = Serial.read();
    if(clearVal == 'C' ) {
      clearLCD();
    }  
  }
  
  if (Serial.available() > 0) {
    delay(100);
    while (Serial.available() > 0) {
      ByteCount ++;
      val[ByteCount] = Serial.read();
    }
  }
  
  if (ByteCount > 0) {
    for (int i = 1; i <= ByteCount; i++) {
      if (val[i] >= '0' && val[i] <= '9' ) {
        val[i]= val[i] - '0';
        Serial.print(val[i]);
      }
    }
    //Serial.println();
    ByteCount = 0;
  }
}

what am i doing wrong here???

any help?
im stuck
i set it up so that when i press a switch the LCD should clear with this code

int val[10];               // variable used to store data from serial port
int ByteCount = 0;
int switchPin = 2;
int switchVal;

void setup() {
  Serial.begin(9600);         // connect to the serial port
  pinMode(switchPin, INPUT);
  digitalWrite(switchPin, HIGH);
}

void clearLCD(){
   Serial.println(0xFE, BYTE);   //command flag
   Serial.println(0x01, BYTE);   //clear command.
} 


void loop() {

  
  
  if (Serial.available() > 0) {
    delay(100);
    while (Serial.available() > 0) {
      ByteCount ++;
      val[ByteCount] = Serial.read();
    }
  }
  
  if (ByteCount > 0) {
    for (int i = 1; i <= ByteCount; i++) {
      if (val[i] >= '0' && val[i] <= '9' ) {
        val[i]= val[i] - '0';
        Serial.print(val[i]);
      }
    }
    //Serial.println();
    ByteCount = 0;
  }
  
  switchVal = digitalRead(switchPin);
  if (switchVal == LOW){
    (clearLCD());
  }
}

also i tried changing the void clearLCD() function to int clearLCD()
still nothing
when i press the button i see the TX light flash and a bunch of jargon on the serial monitor but not on the LCD