Pages: [1]   Go Down
Author Topic: Double Serial  (Read 347 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I must control 1 https://www.sparkfun.com/products/8897 and 2 http://www.basicmicro.com/RoboClaw-2x30A_p_46.html with an arduino uno... Is there any way i can switch the serial lines to control each seperatley with a single serial out from the uno?

-Nick
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any way i can switch the serial lines to control each seperatley with a single serial out from the uno?
What do you mean by "switch the serial lines"? There is one hardware serial port that you can use to talk to one serial device. You may be able to use other pins, and SoftwareSerial, to talk to other serial devices.

SoftwareSerial only allows listening to one device at a time, but if two way communications is not needed, then there is not problem talking to several devices, one at a time.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any way i can switch the serial lines to control each seperatley with a single serial out from the uno?

Probably not.

You can, however, create a software serial that mimics the hardware serial, using interrupts: you can simply load up a char / string to it and the module will send out bits / bytes by itself, and similarly for receiving.
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any way i can switch the serial lines to control each seperatley with a single serial out from the uno?
What do you mean by "switch the serial lines"?

He means having something like a MUX.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 549
Posts: 27427
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you need fast communications to both devices, might be easier to just a uC that has 2 serial ports, such as the ATmega1284P (or one of the lower memory variants - 164, 324, 644)

Bare boards $5 sent via USPS, buy new parts or scrounge from your parts bin.
PL & schematic here
http://www.crossroadsfencing.com/BobuinoRev17/
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any way i can switch the serial lines to control each seperatley with a single serial out from the uno?

In theory yes, but it involves using external logic components to switch the send and receive pins to the separate serial devices and of course you would have to manage that switching with extra code in your sketch. Easier to see if you can use the software serial library or even get a board with more hardware serial UART channels like the mega boards with four, or Bob's board with two.

Lefty
Logged

Pages: [1]   Go Up
Jump to: