View previous topic :: View next topic |
Author |
Message |
zonared
Joined: 24 Mar 2004 Posts: 4
|
RS232 UART TX from multiple PICs at the same time. |
Posted: Tue Sep 15, 2009 6:45 am |
|
|
Hello everyone,
I was just wondering if anyone has ever paralleled multiple PICs via RS232. So all RX pins together and all TX pins together? Sort of like master/slave except the master in my case would be a PC having many PIC slaves.
My problem is all my slaves receive the RS232 transmission from the PC but all try to respond at the same time, no worky.
So I through I would turn off TX by TXEN = false, change the tris of TX pin to an input and monitor for traffic. Then send transmission after a short random amount of time, so each PIC can respond without over lapping comms.
Problem is the TX pin remains HIGH and does not appear to become an input pin. Is what I'm trying to do even possible? Is there something special I have to do with the #USE RS232 directive?
Help appreciated in advance, Thanks... |
|
![](templates/subSilver/images/spacer.gif) |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
|
Posted: Tue Sep 15, 2009 7:49 am |
|
|
You're essentially setting up a star topology and should also therefore be following similar to ethernet or RS-485 where you must sense collisions.
In Ethernet, when a collision is detected, the both hosts stop transmitter, pick a random number and use that as a delay.
The one who's delay expires fiirst transmits first.
Consider adding RS485 interfaces to your system and follow a CSMA/CD scheme.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
TX pin changing |
Posted: Tue Sep 15, 2009 2:53 pm |
|
|
Ben,
Thanks for the reply, you are right it is more like a star network. Which is fine, but I'm having trouble controlling the pins status.
I can change pin to an input and turn off UART TX (on all PICs) but the pin doesnt change state just stays high. The UART is still driving it HIGH and I cant seem to turn if off properly.
Thanks again,
Zonared |
|
![](templates/subSilver/images/spacer.gif) |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
|
Posted: Tue Sep 15, 2009 3:42 pm |
|
|
Why not set the PIC's up as I2C slaves?
I2C is a nice master to multi-slave system.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
![](templates/subSilver/images/spacer.gif) |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Tue Sep 15, 2009 10:28 pm |
|
|
i do this in several instruments that i build
where several pics each run a pair of motion control PWM and timer based rourtines with A/d tacked on.
each pic module has a unit hardware address set with jmprs on Port E,
which is talked up to active response & cmd and state( or silence) based on a selector command - in My case "Pn"<cr>
where n is 0 to 3 ASCII and selects ONE of four, dual listener // talkers
as long as you have a solid deterministic base
and an attention sequence that keeps order , you can do it.
hardware wise:
just parallel ( or 'HC buffer withleft over parts of HC541 etc ) the RX inputs from your MAX-232 to all four pic RX pins.
the TX drives however must be combined thru a 4 input AND gate to the TX of the MAX-232 - any pic not present or powered off - needs a weak ( 10k ) physical resistor on its TX output - pulled up to +Vdd of the pic
for that AND gate input HC08 is what i use
all you have to do |
|
![](templates/subSilver/images/spacer.gif) |
|