USART - source selecting between 2 serial things.

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

USART - source selecting between 2 serial things.

Post by Francis » Thu Mar 11, 2010 10:45 am

I'm a skinflint and want to keep my costs and pin-count down.
I hope to use an 18F25K20 or a 26 and I'm using all the pins except one spare.
Soft SUART no good for this app.

Enquiry: Is there a way of switching the USART Rx pin between 2 external serial sources? i.e. make a kind of source selecter.

The PIC Rx would never receive data from both at once, but I can't find a low pin-count cheapo K series PIC with 2 USARTs and supported by SF.

The code would select the 'source'. I was hoping a couple of MOSFETs could be used, but if someone has tried it and found it useless then I won't go up a blind alley.

I'm trying to avoid a secondary 'multiplex' chip and was hoping a couple of 15p discretes would do the job.

Code: Select all

                               --------SELECT--------
                             \/                      ^
Serial Source 1  -------- (Switch) ----- Rx Pin  -- PIC
                              ^
                              ^
Serial Source 2 --------------|
I hope the explanation is OK - even if the reasoning is deranged :lol:

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Thu Mar 11, 2010 3:19 pm

Actually, i've jsut seen how cheap/small those little TSOP6 Analog switch SPDT are, so I'll go to Plan C.

Jon Chandler
Registered User
Registered User
Posts: 185
Joined: Mon Mar 10, 2008 8:20 am
Location: Seattle, WA USA
Contact:

Post by Jon Chandler » Thu Mar 11, 2010 4:52 pm

Why an analog switch? The incoming serial data is digital.

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Thu Mar 11, 2010 5:03 pm

Well, firstly it was the cheapest thing I could find :)

Secondly, unless I have pull-ups/downs the switch has to be bidirectional i.e. push-pull.
And, besides, an analog thing that can switch rapidly at logic levels with an acceptable resistance and an acceptable speed is 'digital' in everything bar the name I would have thought.
OK, so a 'digital' device may have hysteresis built-in to sort some issues.

Anyway, it's only 39p so I can afford to bin it if it doesn't work.
http://www.farnell.com/datasheets/7356.pdf

Fingers crossed.

Post Reply