Im a bit confused about how this works so bare with me.
I have an Arduino Diecimila which works fine and wonderfully and I want to be able to connect two LCD screens to the board and then send seperate messages to them.
A SoftwareSerial library allows for serial communication on any of the Diecimila's digital pins.
does this mean I can use any of the digital pins as a serial pin to transmit to the two LCD screens?
I was considering using these screens as they only require 1 pin for communication, but im lost on if its possible?
Dont the LCD screens need to be connected via serial for RX and TX?
It depends on what kind of LCD's you're using, you won't need the SoftwareSerial unless you've got Serial LCD's (generally twice the price), but I'm guessing you have a normal 16x2 or 20x4 screen.
But either way, yes you can use both, when you initialize the LCD, you need to add the two, so for example:
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
LiquidCrystal lcd2(8, 9, 10, 11, 12, 13);
then when you're addressing the two, you'll need to use lcd and lcd2 for the lcd's.
lcd.print("Hello");
lcd2.print("World!");
but if you have the Serial LCD's, you can still use both! With alot less pins. Same concept, create 2 serial connections on the Pins, then write the same way.
SoftwareSerial mySerial(2, 3);
SoftwareSerial mySerial2(4, 5);
(these are both initialized before the setup() function)
Then use the same idea for the previous,
mySerial.print("Hello");
mySerial2.print("World!");
but if you have the Serial LCD's, you can still use both! With alot less pins. Same concept, create 2 serial connections on the Pins, then write the same way.
SoftwareSerial mySerial(2, 3);
SoftwareSerial mySerial2(4, 5);
@mathewjenkinson
Serial displays only need 2 pins for the communication with the arduino controller.
As the example shows it is very easy to implement a solution with 2 or more LCD's.
Lol not really sure if uh.. spamming or not, but ??
Anyways, @Mathew
With the SoftwareSerial library you need to initialize each serial connection with 2 ports, tx and rx, it's not going to let you use just one.
There may be a way around that, maybe setting both of the RX to the same pin, and then not use that pin, or it may let you use the pins if you don't use the commands needed to receive, I'm not sure haven't experimented that much.
But yeah you've got the basics down, just need to initialize both rx and tx:
SoftwareSerial lcd(2, 4);
SoftwareSerial lcd2(3, 4);
(I don't recall which is the TX and RX, so you may have to change the 4 around, (4, 2) and (4, 3))
I think you are on the right track with a serial display. I've used this serial display with the arduino before. http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=110427341155 it comes with sample Arduino code and is a good bit easier on the eyes than an LCD because it is a Vacuum Fluorescent Display.
Do functions like serial initializing or servo initializing just not work if you input a pin number higher than 19? If they still worked, you could just set the RX pint o a number >19.
I wonder what would happen if you did SoftwareSerial lcd(2, 2); ?
Does the library check and prevent you from using one pin for both functions? If it doesn't then it might even work. As long as you aren't concerned about and performing serial reads then the transmitter side should happily keep sending serial writes out the pin.
The SoftwareSerial library does not check if the pins are valid so making Tx and Rx pins the same or giving it a pin that does not exist should be ok (as long as you don't actually call the read method)
But if you make the Rx and Tx pins the same you may forget at some future date that the read method will not work.
The following is a little more obvious to someone reading your code that the read method should not be called
SoftwareSerial lcd(-1, 2); // read disabled, write on pin 2
SoftwareSerial lcd2(-1, 3); // read disabled, write on pin 3