have multiple lcd displays,
could use I2c / SPI , but want to be able to update a display a bit quicker than that.
so as data bus is common between all the LCD's
'just' have to have multiple select lines from the arduino to the lcd's
but,
how to code up,
do I instantiate multiple lcd's with common data pins, and different select pins ?
basicaly it boils down to is the library call atomic,
if I define lcd1, lcd2, lcd3,
If it's an Uno you only have one set of serial transmission pins, so no matter how many different serial profiles you define you can still only communicate with one screen at a time or have all of them display the same thing. Now if you have the TX and RX tied to external multiplexer ICs you could theoretically switch between each screen very quickly. However, I've never tried this and therefore don't know how practical or impractical it would be.
You can hook them up in parallel. You need to have a separate pin for E signal for each lcd.
So if using the 4 bit liquidcrystal library you would instantiate each one separately and
use a different pin for E.
btw if you want more speed check out fm's liquidcrystal library replacement.
It is faster at everything on multiple interfaces.
It can send characters to the lcd faster using 2 wires with a shift register than the stock library can
even though the stock library is using parallel mode. https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
The two wire shift register code will update the lcd more than 10x faster than i2c.
If you use LCDs which use the 4bit parallel interface, you could do this:
//Declare an array of LiquidCrystal objects, each with the same data bus, just a different Enable pin
LiquidCrystal lcd[3] = {LiquidCrystal (12, 11, 5, 4, 3, 2),LiquidCrystal (12, 10, 5, 4, 3, 2),LiquidCrystal (12, 9, 5, 4, 3, 2)};
...
//Some function
lcd[0].print("V"); //first LCD
lcd[1].print("VV"); //second LCD
lcd[2].print("VVV"); //third LCD
...
The same as bill has suggested could be used with that array and would use less pins.
Even with a 2 wire SR of the LCD library, aka. the fm LiquidCrystal, or to floresta's protest on the name the "New LiquidCrystal library", you could connect up to 4 LCDs using 8 pins and you would still get a higher performance than with the stock Arduino library driving just one LCD. Or you could use 5 pins to drive 4 LCDs using a common data line and a clock to each LCD.
With only two pins using the I2C for 3 LCDs you would get about 10 frames per second on each LCD.
The standard LiquidCrystal library does not read data back from the LCDs. This means that you can connect multiple parallel-interface LCDs in parallel (even the EN lines) and they should all work, as long as the wires are not too long (if they are, you will need to use line drivers/receivers).
[EDIT: as pointed out in the next post, you can't common the EN lines unless you want all the displays to show the same text.]
I reviewed the post you talk about in answer 7 and this is exactly what I want to do, but I have 2 I2C Lcd's,
I have seen another example where someone has referenced these
LiquidCrystal_I2C lcd1(0x20,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd2(0x21,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
Can you or someone else help me understand the relevance of the addresses in relation to the pin out, for example currently I have a single Ic2 LCD working using the following
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
and the pin outs used on my arduino mega 2560 are SCA and SCL, If I were to connect a second IC2 so I had as an example
LiquidCrystal_I2C lcd1(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd2(0x26,16,2); // set the LCD address to 0x26 for a 16 chars and 2 line display
how do you know which pins to connect the second LCD to?
Sorry if I am highjacking a post it just seems relevant
how do you know which pins to connect the second LCD to?
It gets connected to the same SCA and SCL pins on the Arduino.
When we talk about LCD pin-outs we are typically talking about the connection between the 6 data and signal lines between the LCD and the Arduino in a parallel system or between the LCD and the interface IC if there is a serial backpack involved.
The whole idea behind the I2C system is that you can connect a whole bunch I2C devices to the same Arduino pins as long as each has a unique address. The pinout is therefore exactly the same for all of the devices as they are differentiated from one another by their addresses. The address is transmitted as the first part of the serial stream and the information that follows is ignored by all except the addressee.