View previous topic :: View next topic |
Author |
Message |
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
Two different devices on one UART interface |
Posted: Fri May 01, 2015 7:46 am |
|
|
Greetings! Is there a way to connect 2 different devices on single UART interface of a microcontroller? For example 1 RS485 transiever and something else with enable pin?
Thanks! |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri May 01, 2015 8:12 am |
|
|
Yes. What you describe can be made to work. Obviously both devices need to float their data output line (the line feeding the PIC's RX), when they are disabled, and the line really should have a pull-up, to cover the instant when neither device is driving it.
You can even drive multiple TTL async links, using something like a 4-1 mux/demux, and routing the two lines through these.
However it is dependant on all the devices involved being 'question/reply' type configurations, so they only send data when _asked_. |
|
![](templates/subSilver/images/spacer.gif) |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Fri May 01, 2015 8:37 am |
|
|
Another way to do this is to send the PIC TX out to multiple TTL level devices through a 220 ohm build out resistor to each.
typically you can feed 4 virtual ports this way, quite handily.
the returned TX lines FROM the 4 interfaces( -> PIC RX pin) are best combined using a 4 input positive logic AND gate ( 3/4 of a 74HC08 interconnected) with a 10k ohm pull up resistor to +5 v ( or 3.3v) on each input to allow for potential 3 state operation.
Mr. T's caveat applies: You have to be sure they don't all TALK back at the same time - |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Fri May 01, 2015 3:19 pm |
|
|
Yes, it can be done, as pointed out however.....by the time you R&D the '2-into-1 UART' subsystem you could have bought a LOT of PICs that have 2 UARTs in them !! I can buy a lot of PICs with R&D costing $100/hr.
It's one of those 'penny wise-pound foolish' things. You will waste a LOT of time trying to 'bodge' it,maybe blow 2-3 PCB designs, rewire/redo 2-3 times, frankly it's just not worth the time and effort.
I tend to 'overkill' the PIC position, usually an 18F46K22. Tons of memory, I/O, and of course TWO hardware UARTS. Remember clients always 'need' an extra LED or 'just a little bit' more code.....
Jay |
|
![](templates/subSilver/images/spacer.gif) |
|