Go Down

Topic: Serial.Begin statements (Read 536 times) previous topic - next topic

Yesenia

Hi...

         I have a question regarding the use of multiple serial.begin () statements in one program? I have a program that requires it to begin a (9600
and the other to begin at (19200). What I want to do is have a serial.begin(19200) to make a phone call. The second serial.begin(9600) will "speak" something saved from an SD card, and I will send the audio via a cable from one shield to the other.

My question is: Can I have multiple serial.begins activated at the same time? And how can I have them interact with each other?

Thanks

James C4S

How will the actual devices know when the incoming data isn't for them?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

mixania

#2
Mar 19, 2013, 06:59 pm Last Edit: Mar 19, 2013, 07:00 pm by mixania Reason: 1
There are four functions in the Arduino IDE:

Code: [Select]
Serial.begin();
Serial1.begin();
Serial2.begin();
Serial3.begin();


(Serial4.begin(); and on doesn't exist)

This will permit you two establish several RX & TX lines. However this only works on the Arduino Due and Mega because they have more than on pair of RX TX pins.()

Here are the pins n the Due for example:
Serial: 0 (RX) and 1 (TX)
Serial 1: 19 (RX) and 18 (TX)
Serial 2: 17 (RX) and 16 (TX)
Serial 3: 15 (RX) and 14 (TX)


Multiple RX and TX communication is not supported on other Arduino Boards, sorry. :)
Arduino Uno R3
Mac OSX Lion

James C4S


Multiple RX and TX communication is not supported on other Arduino Boards, sorry. :)

Not in hardware. 

There is still SoftwareSerial available.  Depending on the device, this may be sufficient.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Yesenia

Quote
There is still SoftwareSerial available.  Depending on the device, this may be sufficient.


So how would I go about using the SofwareSerial?

James C4S

http://arduino.cc/en/Reference/SoftwareSerial
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

mixania


Not in hardware.  

There is still SoftwareSerial available.  Depending on the device, this may be sufficient.


Didn't know that it is possible through software, but here is what the Library also says:

Quote
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
Not all pins on the Leonardo support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).


It talks about the Mega and the Leonardo but not about Arduino UNO for example. So is it actually not compatible with all models?
Arduino Uno R3
Mac OSX Lion

James C4S

It was created for the Uno.  Many, many projects use it.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up