Okay, here's another thought.
Use 2 optos; each output feeds each target.
The serial out goes to the anodes of both the opto inputs; the 2 cathodes go to 2 separate pins, each of which can be selectively pulled low to allow transmission to the corresponding target.
Anand
I have successfully used a 74HCT125 for this purpose. You can selectively enable each gate to drive what you want. If you add a pull up on the output of each gate, you can "idle high".
One package (two gates for TRANSMIT, two devices for RECEIVE) plus an inverter will allow you to use one pin to select which device you want to "speak to".
Connect PIC TXD to the inputs of two gates (call them A & B) Connect the output of A to
device 1, connect the output of B to device 2.
Connect the outputs of gates C & D to the PIC RXD. Connect the input of C to device 1 and the input of D to device 2.
Connect the ENABLES of gates A and C together, and the ENABLES of B & D together.
Put an inverter between the pairs of enables. Drive the input of the inverter from a PIC pin.
Charles Linquist
How about my favourite STG3157? ok ... a bit much expensive i agree...
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Timer1 maybe?
I've been playing with this all day, just got it working a little bit ago.
I don't know if this fits in with your program but I figured, Since the problem is the timing disruption of the SEROUT commands by the interrupts, that a SEROUT equivalent driven by a Timer might solve it. Kind of cross between USART and software serial. Might solve a lot of peoples SEROUT problems.
Still have some more to do on it, but was wondering what kind of data you're sending. DEC, HEX, STR, ??
Are your other Interrupt handlers SHORT?
Which Timer is available?
<br>
DT
Wow. Thats impressive.
I'm sending strings of data. But of course that can be easily accomplished with sending bytes in a loop.
The other interrupt handlers are mostly short. But i guess thats a relative term. Most of them just record an input, or an event and the time that it occurred, and throw that data in a circular buffer to be handled when the main program gets around to it.
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
Bookmarks