Hi,So I've got two 40x2 character lcds and I'm using the LCD3Wire library to drive them, via two 4094 shift registers. My problem is that which ever lcd object is created last becomes the only on that gets used. For example:

lcd.printIn("This is a test of display one."); delay(500); lcd.clear(); lcd2.printIn("This is a test of display two."); delay(500); lcd2.clear();}

Results in the first LCD, (using the object lcd) printing "This is display one" as well as "This is display two". If the lcd2 object had been created last it would display the same thing while the other did nothing. So somehow both the lcd objects end up pointing at the same physical device even though their constructors are given different values. The last one created seems to overwrite the initialization of the previous.

I'm assuming that it is some sort of constructor issue with the library itself but I'm a little rusty. Again I assume somehow the variables for the pins are being shared by both instantiations of the LCD3Wire objects, I just don't know where to go from here. Can anyone help or point me in the right direction.

Isn't the strobe pin used to tell the LCD that you are talking to that particular display?

If this is the case, try to mod the library to switch displays based on an extra value passed to the procedure.. have both the clock and dout pins tied to both displays but the strobe pins on a separate line.In the case of 4-wire library we can just have two Enable pins..Or you could modify the library so if the 'cursor' is set to line 5,6,7 or 8 instead of line 1,2,3 or 4 it will use the other pin(s) to the second screen..After that you need to delete the .o file in the library so it will recompile.

Were can I find the LCD3Wire library ? I searched on google and my Arduino install folder, nothing...I wanted to look in the file, maybe some global vars are declared (I was thinking about the pins you pass as parameters), which will obviously overwrite the previous settings if it's the case...

//Data, Clock and Strobe pins are set using the constructorint dat_pin;int str_pin;int clk_pin;

//number of lines of the LCD, set using the constructorint lcd_lines;

Try removing these 4 external declarations.

And putting them inside the class definition in the .h file. Delete the .o file and recompile the library. Hopefully that will get it to work for you. the class definition should look something like this

FYI: Since the strobe pin is what latches the data from buffer to the LCD chip this is exactly the only pin you need to separate between the two displays to use them separately... If both displays share the same clock and data, but you only strobe the particular display you want to feed data to, that is the only one that will update.. it doesn't matter what data you clock to the other display it will ignore it until it receives its own strobe and then it will only accept the last byte it was sent, ignoring all previous data.