Sharing Serial connection
I have a situation where a PC and a PIC need to be able to send data to a serial (RS232) device.
When the PC is being used I want to disable the PIC from sending data. I have a switch right now that is a PC/PIC selector. (Might looking into sensing DTR latter) Basically it disables TX on the PIC when the PC is being used.
What is the best way to protect the TX pins on the PC and the PIC? I was thinking of just using some diodes on both TX pins to keep it simple. (RX should be a none issue) Is that OK or should I go with a mechanical disconnect like a relay?
Thoughts?
I don't understand your problem much
Hi,
When you are using a PC to PIC comm. you are necessarily using a software at the PC side. In its simple form there could be two situations :
1. Your PC side program is running.
2. Your PC side program is not running.
Situation1 : Your com port is open and cannot be used by any other prog. So no issues on the TX part.
Situation2 : Your PC app for the PIC is not running and you want to use another prog with another connection.So a TX from the other devices cause a conflict with your TX output.
Using the DTR is not a recommended option as there can usage of it by the other device.
At this moment what I can think of is a thru connection via your PIC module.
Use a Relay or CMOS switch to select one of the TX (either the PIC or the shared device). Depending on the priority you want you can sense activity on the other TX and switch from the PIC to it. Otherway round is to poll for a particular string on the RX line to enable the PIC TX or it is a thru of the other device.
Please ellaborate your PC-PIC and other device connections. Whether you are using a level translator or a simple resistor. Also which PIC you are using and the type of other device (PIC type or true RS232)
Regards
Sougata
Can we have some more details on the PIC
Hi,
Luciano's solution can be best and economical. But it is hard to comment without a little more detail. So ben give us some more info.
Regards
Sougata