Pages: [1] 2   Go Down
Author Topic: Can i connect two 16x4 lcd displays to arduino meg  (Read 9133 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it technically possible to connect 2 16x4 lcd display's to arduino mega? I want to develop a system for my ppo volvo 740 diesel. I want to place 2 displays. One that shows constantly the temperature measured on different places in the system. And the other display will tell me if system is on temperature, if system will switch automatically or manual, and all the other stuff im thinking about.

But before i start is it possible and how do i connect 2 displays?
« Last Edit: February 12, 2010, 05:04:49 am by machtigespa » Logged

B0100111001000011, USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1503
I'm confused.  Wait, maybe not..
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I suppose it's possible if you have enough pins (which the Mega does).

You'd just connect them to separate pins, and start two instances of the LCD library.

Someone once mentioned that you could share all the data lines and have separate enable pins so that you could technically use two with only 16 pins, but I have no idea how well / if that even works.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Someone once mentioned that you could share all the data lines and have separate enable pins so that you could technically use two with only 16 pins, but I have no idea how well / if that even works.
There's no reason for it not to work - this is precisely how the 40x4 displays are configured except that both of its 20x4 displays are in the same glass enclosure.  You share the RS line (and the R/W if used) in addition to the data lines.  Only the E lines are separate.

Don
« Last Edit: February 12, 2010, 10:10:53 am by floresta » Logged

Mobile, AL
Offline Offline
Sr. Member
****
Karma: 0
Posts: 314
CAUTION!-Slow Learner
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don, How do you enable the E lines for the separate displays? Do you use the standard LiquidCyrstal library now used?

Perhaps a snippet of sample code to display "hello World" and "Hey World" on each display?

Thanks,
Ken H>
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ken:
I'm afraid I can't give you any ironclad answer to this because I tinker mostly with assembly language (on arduino clone hardware).

As TchnclFl mentioned, you have to start two instances of the LCD library which I think you would do somewhat like this:
LiquidCrystal lcd1(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd2(12, 10, 5, 4, 3, 2);

(note that the Enable lines are assigned to different pins)

I have been wanting to try this for a while - I'll try to do something this afternoon and get back to you.  It will give me an opportunity to use the real Arduino that I got in the Sparkfun free day.

Don
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ken:

It works as advertised - film at 11.

Don
Logged

Mobile, AL
Offline Offline
Sr. Member
****
Karma: 0
Posts: 314
CAUTION!-Slow Learner
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OH Boy!!!!  Don - I'm getting my popcorn ready smiley 8-) :smiley

That seems like a useful bit of info to learn.

Ken H>
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's the code I used .  All I did was add a few lines to the 'hello, world!' example code.

Code:
// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd2(12, 10, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of rows and columns:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
  
  lcd2.begin(16, 2);
  // Print a message to the LCD.
  lcd2.print("hey, world!");
  
    lcd2.setCursor(0, 1);
    lcd2.print("it works!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

I have a nice picture, but the ftp access to my web space is not working at the moment.  I'll add it when I can.

It's fixed - Here's the photo:



Don
« Last Edit: February 12, 2010, 06:20:03 pm by floresta » Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 262
bluesmokelabs.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So this can be done using just 1 extra pin? Will extra LCDs drastically effect the performance of the 'duino?
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thegeekway:

Quote
Will extra LCDs drastically effect(sic) the performance of the 'duino?

Probably not, within reason.




Don
« Last Edit: February 12, 2010, 09:00:21 pm by floresta » Logged

Mobile, AL
Offline Offline
Sr. Member
****
Karma: 0
Posts: 314
CAUTION!-Slow Learner
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is just too slick!!!  It looks like the LiquidCrystal knows which LCD to print to by the LCD.print vs lcd2.print just by the defining the LiquidCrystal lcd2 wiring?  Then for #3 and 4 LCD you used lcd3.print and lcd4.print?

That is just too slick!  I'll have to try that over the weekend - THANK YOU!!!

Ken H>
« Last Edit: February 12, 2010, 09:43:02 pm by KenH » Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ken:

Quote
Then for #3 and 4 LCD you used lcd3.print and lcd4.print?
You got it ...

 lcd3.begin(16, 2);
  lcd3.print("LCD #3");
  
  lcd3.setCursor(0, 1);
  lcd3.print("it still works!");

  lcd4.begin(16, 2);
  lcd4.print("LCD #4");
  
  lcd4.setCursor(0, 1);
  lcd4.print("Send more LCDs");


Don
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thx for the info.

great community.

i'm actually completely new to arduino and C, but im learning quick
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 236
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i though of using Photoshop to overwhelm you....
 smiley-wink
Logged

MD, USA
Offline Offline
God Member
*****
Karma: 2
Posts: 663
A jack of all trades and a master of none!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dumb question but just want to be sure. I'm thinking of getting a 20x4 LCD to go along with the 16x2 i already have. So am i safe to assume that i can hook like the above examples?

I figure all i'd have to do is declare the 2 screen in setup correctly. For example:
Code:
// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd2(12, 10, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of rows and columns:
 [glow] lcd.begin(20, 4);[/glow]
  // Print a message to the LCD.
  lcd.print("hello, world!");
  
  [glow]lcd2.begin(16, 2);[/glow]
  // Print a message to the LCD.
  lcd2.print("hey, world!");
  
    lcd2.setCursor(0, 1);
    lcd2.print("it works!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}
 

Like i said stupid question but just want to be sure.
Logged

Pages: [1] 2   Go Up
Jump to: