Loading...
Pages: [1]   Go Down
Author Topic: Two UARTS?  (Read 586 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 75
Posts: 6977
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

NewSoftSerial, look it up in the reference.

______
Rob
Logged

Rob Gray aka the GRAYnomad http://www.robgray.com

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

NewSoftSerial, look it up in the reference.

______
Rob

Thanks! Go the link http://arduiniana.org/libraries/NewSoftSerial/ from reference. It has all the info.

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

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 75
Posts: 6977
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad http://www.robgray.com

Netherlands
Offline Offline
Tesla Member
***
Karma: 101
Posts: 9553
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

United Kingdom
Offline Offline
Faraday Member
**
Karma: 146
Posts: 4908
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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).
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com

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


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).
Logged

United Kingdom
Offline Offline
Faraday Member
**
Karma: 146
Posts: 4908
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven't used a color LCD, however a quick search turned up this http://proto-pic.co.uk/color-lcd-shield/ which looks to be a SparkFun product.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com

Pages: [1]   Go Up
Print
 
Jump to: