1

I'm looking for a way to use Arduino UNO's as serial outputs or input "individually", I don want to have an RX pin for each TX pin. I know the library SoftwareSerial, but I'm not sure if it is posible to achieve my objective with it.

I have also read that in this library "If using multiple software serial ports, only one can receive data at a time". Is there any library or method I can use to achieve both of my objectives, using pins "individually" and receiving data from more than a pin at a time?

Thank you for your time.

migrated from electronics.stackexchange.com Feb 19 '16 at 22:54

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • 2
    The reason you can't receive more than once channel at a time with software serial is that there is only one CPU - how can it process two asynchronous channels at the same time? – Tom Carpenter Feb 19 '16 at 20:19
  • 2
    @TomCarpenter It's certainly possible but it would require some gnarly interrupt-driven sampling/sending, and would work only at limited (relatively low) baud rates. – Spehro Pefhany Feb 19 '16 at 20:33
  • 1
    @SpehroPefhany I was talking about the SoftwareSerial library which uses busy loops for generating the baud rate. I should have made that more specific. Yes you can potentially do it if you write your own RX code of find one which doesn't block. – Tom Carpenter Feb 19 '16 at 20:35
  • @RobhercKV5ROB This one is probably best migrated. – Spehro Pefhany Feb 19 '16 at 20:38
  • 1
    Not about electronics, and you mentioned "arduino". – Olin Lathrop Feb 19 '16 at 20:39
1

I don't want to have an RX pin for each TX pin ...

I adapted the SoftwareSerial library a while ago to omit the receiving part. You can download that from:

http://www.gammon.com.au/Arduino/SendOnlySoftwareSerial.zip

You use that like SoftwareSerial but if you read you will always get -1 returned, and available always returns 0.

The constructor only has the transmit pin:

  SendOnlySoftwareSerial(uint8_t transmitPin, bool inverse_logic = false);

Is there any library or method I can use to achieve both of my objectives, using pins "individually" and receiving data from more than a pin at a time?

You don't want an Rx pin, but you want to receive from more than one pin at a time? Now you've lost me.

Sounds like an X-Y Problem - maybe describe this requirement in more detail.

Having said that, hardware serial can receive from one pin while the processor is doing something else. If you have a Mega you could receive from 4 ports at once (it has 4 x hardware serial ports).

1

AVR304, "Half Duplex Interrupt Driven Software UART on tinyAVR and megaAVR devices" describes how to implement a half-duplex software UART using 2 pins. Simply omit the half of the UART that you do not need in your own implementation.

0

Serial ports do not require both directions to work. You can connect just one if you want. Of course you won't be able to reply or receive but you know that. Multiple TX from a microcontroller is easy. Just send the data at the speed required. RX is harder because you have to be able to read multiple high speed random inputs at the same time. It requires careful and complicated coding and will not be small or simple. You may not be able to do it and the rest of your project as well.

There are ICs or setups that can multiplex serial lines though. See https://electronics.stackexchange.com/questions/111491/multiplexing-ttl-serial-lines-with-transistors

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.