Serial Graphic LCD 160x128 sku: LCD-08884

Hello,

First of all hello everyone. New to Electronics, Ardunio, programming in C.

I have a Serial Graphic LCD 160x128 sku: LCD-08884 from skarkfun.com

I have sucessfully via serial commands sent one line text messages to this device, but can not get it to accept LF or carrige returns. What is does is just print the first line of text then a special character and then proceeds with the second line of text all run together. I want to be able to esentially print text results to the screen one line at a time. Perferably Text 1 on left of screen, text2 right of screen, text 3 next line left of screen, text 4 right of screen and so on. My LCD is a 160x128 so the space is there. I just can not firgure out why the code for Line feeds, carrige returns are not working. Also is there a command to print to screens in diffrent quadrants?

I have many questions and hope someone is familiar with the LCD I'm tring to use to possibly assist with other questions.

Thanks,
MadDawg

Okay, I have talked to Tech support at Sparkfun and they indicate that this particular LCD does not accept line feeds or carriage returns and would just produce garbage in it's place. To do what I wanted to accomplish would require placing text using the X/Y cordinates on the LCD. Which is actually better anyway. So I will try tonight the X/Y and see how it foes.

Thought I woudl post incase another beginner was looking.

Now if I could only figure out the other things like Backlight control

Cheers,

MadDawg

Do you mind sharing some code mate?
It would really be helpful.

I will see what I can provide. My code is rather crude and poorly written. But works for the most part. I have discovered some issues with graphics. I was trying ot draw an images logo on 50x50 in size and got a bunch of randomized lines. Plan on re-writing the code to use pixels instead of lines to see if that works. Also Sparkfun documentation in not accurate on a few commands though I think they fixed it. I discovered the discrepancy. I still can not get the Backlight to work. Anyway, I will try and send code later when home.

MadDawg

My lcd makes me very frustrated...
It seems that the "cursor" is running across the screen all the time deleting everything, unless I print something where it appears kind of gibberish, until the "cursor loop" reaches it and deletes it once again.

Any clue as to what is going on?

I would really appreciate some code.
Even some Hello world example.

Thanks a lot

That sounds like a Buad rate issue. If your Code and the Baud rate do not match you will get garbage. By default the Baud Rate for the screen is set to 115200bps. I find that 9600 is best but do use higher. Code for baud rate change is in documentaion and works. However, initial code to screen has to be 115200, send the baud rate change then mod code to reflect changed baud rate afterwards. Otherwise the Screen never gets the baud change request.

Here is some stuff to get you started. Basically, I clear the screen, draw a box, place the cursor to x,y and then print some text.
Hope this helps.

int serTXpin = 1;   // select the pin for the TX
void setup()
{    
    pinMode(serTXpin,OUTPUT);  // declare the 1 pin as output for TX
    Serial.begin(112500);      // connect to the serial port 
    Serial.print(0x7C,BYTE);   // Command prep code must send prior to most commands to screen
    Serial.print(0x00,BYTE);   // Clears screen/ 
}
void loo()
{
   Serial.print(0x7C,BYTE); // command prep code
    Serial.print(0x0F,BYTE); // Draws a box around the screen
    Serial.print(0x00,BYTE); // x1
    Serial.print(0x00,BYTE); // y1
    Serial.print(0x9F,BYTE); //x2
    Serial.print(0x7F,BYTE); //  y2
    Serial.print(0x01,BYTE); // displays the pixels 0x00 hides the pixels opposite result when scree inverted
    Serial.print("\x7C\x19\x19");  //  another way to send code in one line. This  places text cursor to x corrd
    Serial.print("\x7C\x18\x3B");  // this sets the Y corrd
    Serial.print("Test Text");       // Text sent to screen at above corrd.
    delay(5000); //Added as the loop causes screen to do all sorts of crazy stuff when redrawing the above. Best to place this all into a function and call it when needed.

Regards,

MadDawg

BTW - If anyone else uses this screen I need help getting the Backlight to work. I think the documentation is wrong, as it does not work with given commands.

For some weird reason, the cable I m using to connect its Rx to the arduino, introduces noise and the screen image gets all messed up, even when the other end is not connected to anything.

Anything that I can take care while connecting it?

What kind of cables do you guys use?