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 support@ccsinfo.com

RS232 UART TX from multiple PICs at the same time.

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



Joined: 24 Mar 2004
Posts: 4

View user's profile Send private message MSN Messenger

RS232 UART TX from multiple PICs at the same time.
PostPosted: Tue Sep 15, 2009 6:45 am     Reply with quote

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...
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Sep 15, 2009 7:49 am     Reply with quote

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
Guest








TX pin changing
PostPosted: Tue Sep 15, 2009 2:53 pm     Reply with quote

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
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Sep 15, 2009 3:42 pm     Reply with quote

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
asmboy



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

View user's profile Send private message AIM Address

PostPosted: Tue Sep 15, 2009 10:28 pm     Reply with quote

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