Go Down

Topic: Double Serial (Read 353 times) previous topic - next topic

N314

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

PaulS

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.

dhenry

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.

WizenedEE


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.

CrossRoads

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

retrolefty

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

Go Up