Go Down

Topic: Serial LCD BPK help !!!!!!! (Read 1 time) previous topic - next topic

vikash kumar

Hi,

I am working on a project on Home Automation using arduino . I am using a serial LCD display (4x20 white on blue) from http://www.milinst.co.uk/. I dont know how to interface with arduino. I used the data sheet and i am not getting the output. can anyone guide me by step by step process with a sample code so that i can understand well.

robtillaart


- http://arduino.cc/en/Tutorial/ASCIITable -

connect GND and 5V from Arduino to LCD

connect arduino pin 1 = TX to LCD RX

succes,
Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

liudr

How did you connect the display to arduino and what code did you use. We don't have a crystal ball here so you have to show some pics and code.

"either 2400 or 9600 baud, no parity, 8 bits, 1 stop bit and inverted format."

I wonder if you noticed inverted format or baud rate (jumper setting)

vikash kumar

i had three pins. +,GND,Serial out. i connected +,GND to arduino +5V and GND respectively. Serial to arduino TX pin. 2400 baud rate is OFF and 9600 is ON in my serial LCD. I used the below code

void setup() {
  Serial.begin(9600);
               
  Serial.print(1, BYTE);  //Clear Screen
  delay(5);
  Serial.print("Hello world");

}

I dint get any output. help me !

void loop() {
}


vikash kumar

to ROB

I did what you have said. but i am not getting the output. I have attached the Data sheet. please give me a sample program using the data sheet i have attached.

liudr

Did you have a delay in the setup to allow the serial lcd to start up as described in the manual? Also did you see what I replied, inverted format? I don't think arduino's serial is configured for inverted format. Can someone confirm this?

robtillaart

(not read the PDF, but building upon liudr's comment)

NewSoftSerial has a flag to send inverted bytes. The hardware Serial of the UNO can't do this AFAIK.

Vikash, download NewsoftSerial and start testing with that

In the meantime, could you try this testsketch to see if inverted code works.
Code: [Select]

void setup()
{
  Serial.begin(9600);
               
  Serial.print(1, BYTE);  //Clear Screen
  delay(5);
  Serial.print('A' ^ 0xFF);   // single char inverted.
}

void loop() {}
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

vikash kumar

void setup()
{
  Serial.begin(9600);
  delay(500);
  Serial.print(254,BYTE);

  Serial.print(1, BYTE);  //Clear Screen
  delay(5);
  Serial.print('A' ^ 0xFF);   // single char inverted.
}

void loop() {}



i used this code with the delay and (254,BYTE) to differentiate between control code and normal character. i get the output as a triangle shaped dots all over the LCD screen. U can see under 'fig.5 character code chart' 0 under 128. I have attached the file for you

And to liudru my LCD can display inverted format.

vikash kumar

i downloaded newsoftserial from http://arduiniana.org/2011/01/newsoftserial-11-beta/. but i dont know how to include under example or library folder.

Cylindric

The Beta is different to before - it replaces the core library SoftSerial.  So you need to find the SoftSerial folder in your Arduino folder and remove it, and then put the NewSoftSerial there instead.
Current Projects: Rodentometer - Hamster Endurance Moni

liudr

Can you try more delays right after you send the clear screen because this command may take more than 5ms to run. You only gave it 5ms.

If you forget the clear screen for a moment and just print one character at a time every second, do you see any characters appearing on the screen?

The screen seems to be a design 10 years old so the hardware may be that old too, there is a chance it is broken.

vikash kumar

i used a delay of 10 ms as mentioned in the data sheet. but even tho i am not getting the output. this is the code which i used recently


void setup()
{
Serial1.begin(9600);
delay(500);

// Move cursor one character left

Serial1.print(254, BYTE);

Serial1.print(1, BYTE);
delay(10);
//Serial1.print("Hello");
}

void loop()
{


//Serial1.print(254, BYTE);

//Serial1.print(1, BYTE);
//delay(100);
}
// clear the LCD


i have attached the output for my code and the back view of my LCD screen. U can see the data sheet too alonb with this reply.

in the data sheet it is mentioned as

" Baud Rate?
The Driver Board will accept RS-232 signals at either 2400 Baud (jumper missing) or 9600 Baud
(jumper installed). "

is there anything to be done with this.?

vikash kumar

Hi to all...

thanks a lot for your help....

my LCD is working fine. I used a SN74LS04N inverter for the LCD serial input and the following code. I used serial1 because i am using Arduino Mega and i use TX1 for output.
void setup()
{
  Serial1.begin(9600);
  delay(500);
  Serial1.print(254,BYTE);

  Serial1.print(1, BYTE);  //Clear Screen
  delay(10);
  Serial1.print("hi");   // single char inverted.
}

void loop() {}


I get the expected output as hi

liudr

That's what I suspect, the inverted logic as written in the document. BTW you can take robtillaart's suggestion to use NewSoftSerial, which can be set to output inverted logic.

I have a question for you: did you buy this display for a PIC?

vikash kumar

NO i bought this for arduino mega

Go Up