CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Two different devices on one UART interface

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

Two different devices on one UART interface
PostPosted: Fri May 01, 2015 7:46 am     Reply with quote

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!
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Fri May 01, 2015 8:12 am     Reply with quote

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_.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri May 01, 2015 8:37 am     Reply with quote

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 -
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri May 01, 2015 3:19 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group