Two UARTS?

I ma using an LCD and a GPS module in my project. Both require a serial connection, but arduino has only one.

What do you generally do to use two serial devices on a asingle board?

NewSoftSerial, look it up in the reference.


Rob

Graynomad:
NewSoftSerial, look it up in the reference.


Rob

Thanks! Go the link NewSoftSerial | Arduiniana from reference. It has all the info.

btw, How many serials pins are there on UNO which I can use for serial devices?

A Uno has 20 IO pins, if you don't count the two hardware serial pins that leaves 18. I assume they can all be used but I haven't tried it, there may be a limit imposed by NSS or available RAM to be used for buffers.


Rob

For a Serial LCD you only need the TX line to send to the display, you can define the RX line in NewSoftSerial as -1 and the lib will not use any real pin. So effectively using only one pin!

The GPS probably need both TX and RX line. Use the HW serial for that,

BTW be sure to decouple any device from the HW serial if you want to upload a new sketch...interference...

If you use NewSoftSerial, bear in mind that it disables interrupts during the whole period of transmitting or receiving each character. So the GPS had better not be sending you any data during that time, because it will get lost or garbled. Unless you are using an Arduino Mega (which has multiple hardware UARTs), I suggest using an LCD display that has either a parallel interface or some other intefrace that doesn't need a hardware or software uart (e.g. SPI or I2C).

dc42:
I suggest using an LCD display that has either a parallel interface or some other intefrace that doesn't need a hardware or software uart (e.g. SPI or I2C).

Thanks dc42!
Can you suggest me such LCD or a shield? (I need a color lcd).

I haven't used a color LCD, however a quick search turned up this OpenMV LCD Shield - Next Day Delivery UK - which looks to be a SparkFun product.