Go Down

Topic: Serial to LCD - How to display second line on 16 x 2 (Read 1 time) previous topic - next topic

Abhisheik

I am using the standard serial display example in arduino to write a string on lcd. However if the string is longer then 16 chars, the rest seems truncated. Also it does not wrap to second line.

Can anyone suggest.

Arduino V 1.0.1 | Arduino UNO | Standard LCD library

floresta

#1
Jul 16, 2012, 04:19 pm Last Edit: Jul 16, 2012, 04:26 pm by floresta Reason: 1
Quote
I am using the standard serial display example in arduino ....

To my knowledge the Arduino IDE does not come with any serial display example.  The reason for this is that there is no standardization among the various vendors of serial LCD adapters.  On the other hand virtually every parallel interface uses the defacto standard established by Hitachi with its HD44780U controller and this is the one supported by the Arduino IDE.

Quote
However if the string is longer then 16 chars, the rest seems truncated. Also it does not wrap to second line.

This is quite normal.   You can find an explanation of what is supposed to be happening by following the LCD Addressing link at http://web.alfredstate.edu/weimandn.

Try writing a string of 80 characters and see what happens.  Here is a sample sketch for the parallel interface, you will have to modify it for your particular serial setup:


Code: [Select]
#include <LiquidCrystal.h>

//LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);       // put your pin numbers here

void setup()
 {
   lcd.begin(20, 4);                          // put your LCD parameters here
   for (char i=47; i<127; i++)                // send 80 consecutive displayable characters to the LCD
     {
       lcd.print(i);
       delay(100);                            // this delay allows you to observe the addressing sequence
     }
 }


void loop()
 {  
 }




Don

dxw00d

#2
Jul 16, 2012, 04:22 pm Last Edit: Jul 16, 2012, 04:24 pm by dxw00d Reason: 1
Quote
To my knowledge the Arduino IDE does not come with any serial display example.

The LiquidCrystal library is supplied with the IDE, and contains a number of example sketches, including SerialDisplay, which reads from serial input, and writes to the LCD.

floresta

Quote
The LiquidCrystal library is supplied with the IDE, and contains a number of example sketches, including SerialDisplay, which reads from serial input, and writes to the LCD.

Thanks for the clarification.  All I can say is that the Arduino version of the English language is infinitely better than my version of the Italian language. 

The SerialDisplay example in question forwards data that is received on the serial port of the Arduino to a generic parallel LCD.  I would call this DisplaySerial or DisplayOfSerial myself.

My answer to his question (aside from the mention of modifying the code) still stands.


Don

Abhisheik

Hello Don,

Thanks you for your suggestion. Here is the output from my 16x2 LCD ( Sorry of bad camera quality of my blackberry)

I think i got the idea of how it can be done when sending data from my arduino. But when i am sending data from my serial port the thing get truncated. Anyways i will try this code in that as well and will post the result.
Thanks again.

Go Up