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 CCS Technical Support

direct serial and RS232 max distances

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



Joined: 08 Apr 2005
Posts: 5

View user's profile Send private message

direct serial and RS232 max distances
PostPosted: Wed Aug 10, 2005 3:42 pm     Reply with quote

I did read numerous other posts on this subject but did not find the answer...

I would like a master PIC to communicate bidirectionally with 11 slave PICs from 2' to 8' away. (i.e. master sends address and command to all slaves, only one slave responds with requested data).

Based on other posts, I believe I2C should not be used beyond ~ 3'.

I was therefore thinking of half duplex direct serial comm because it seems simple and I *think* it would work without RS232 level changing chips (e.g. max232).
I'd like a master software UART to talk to the slave hardware UARTs.

My questions:
1. Can the master PIC support fanout to the slaves for a slow data rate (~ 9.6k) when using twisted stranded & shielded wire?

2. Is there *someway* in hardware to permit multiple slaves to connect their Tx lines to the single Master Rx line? e.g. Will an output_float () command in each quiet slave (i.e. not talking to the Master) be sufficient to isolate their Tx lines?

3. Is there anything else I should keep in mind regarding pullup or coupling resistors, etc.


Thx.
Ttelmah
Guest







PostPosted: Wed Aug 10, 2005 4:09 pm     Reply with quote

The answer totally depends on you enviroment. Simple logic signals like this, can be used over a distance like this, but you have to consider how much noise if present, and input protection together with whether ground loop problems, and/or voltage spiking is likely to be met. If you want reliability, go back to thinking RS485. The IC's involved provide a lot of protection. If doing it with simple logic, I'd definately consider a cheap buffer like the 74LS04, as being more 'sacrificable', than the PIC itself.
Give some more details of the ikely enviroment, and some ideas may be forthcoming.

West Wishes
jensen1d



Joined: 08 Apr 2005
Posts: 5

View user's profile Send private message

PIC master-slave details
PostPosted: Wed Aug 10, 2005 4:35 pm     Reply with quote

Environment is benign. Distance seems to be the main factor.
Master just pings all slaves at once, slaves read photo sensors and relay data back to master when requested in round-robin fashion.

Master (18F458)and slave procs (16F87s) running off same power supply.
Decoupling caps on all PIC power supply pins.
I planned on common ground point via fat ground wire in the cable to all slaves. should it be solid? stranded?

Good point about sacrificial LS04. I considered that earlier...
I used an HC14 (schmitt trigger inverter) to drive 6' solid unshielded wire into an HC238 (just as a test of signal integrity over long wires)
There was severe ground bounce and overshoot.
I got cleaner signals when the PIC drove the wire directly.
(I haven't tried stranded shielded yet).
Wire inductance has become a concern of mine.

Would LS work better than HC to drive appropriate wire?
Ttelmah
Guest







PostPosted: Wed Aug 10, 2005 4:41 pm     Reply with quote

Try the HC again, but feed it into a cable pair. At the far end add a terminating resistor across the pair (about 120R for normal twisted pair cable). You are seeing reflections because of the faster switching edges. this is again one advantage of the proper buffers. On 'better' units, there are actually pins that control the switching speed, and the standard forms still contain circuitry to limit the maximum frequencies being generated. Philips do make high power I2C tranceiver chips, which might be worth looking at.

Best Wishes
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Aug 10, 2005 7:25 pm     Reply with quote

Quote:
Based on other posts, I believe I2C should not be used beyond ~ 3'.

I was therefore thinking of half duplex direct serial comm because it seems simple and I *think* it would work without RS232 level changing chips (e.g. max232).
I'd like a master software UART to talk to the slave hardware UARTs.


If you want quick, dirty and likely to fail eventually then RS232 without level drivers has the same order of probability of working as I2C does at the distances you mentioned. I2C at a 9.6K bit rate will get you several metres in a clean environment.

However, I would not do it this way, I would use RS232 line drivers for point to point, RS485 for point to point or bus operation (simple to implement) or some similar technology.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!


Last edited by asmallri on Wed Aug 10, 2005 9:07 pm; edited 1 time in total
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Aug 10, 2005 8:02 pm     Reply with quote

RS485 solution is a robust and reliable option.
There are a lot of transceivers of different generations and special features but
all meet the RS-485/RS-422 Specifications:

Code:


SIPEX             SP1485E
MAXIM             MAX3157
Analog Devices    ADM483
LINEAR            LTC1481/83/87
INTERSIL          ISL4485E
NATIONAL          DS36C278/9
TEXAS             SN75176

and much more....


If you want to read some basic info regarding the difference between RS232 and RS485
Standards, take a look in the following link.

http://www.hw.cz/english/docs/rs485/rs485.html

Best wishes,

Humberto
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: direct serial and RS232 max distances
PostPosted: Thu Aug 11, 2005 3:46 pm     Reply with quote

jensen1d wrote:

My questions:
1. Can the master PIC support fanout to the slaves for a slow data rate (~ 9.6k) when using twisted stranded & shielded wire?

2. Is there *someway* in hardware to permit multiple slaves to connect their Tx lines to the single Master Rx line? e.g. Will an output_float () command in each quiet slave (i.e. not talking to the Master) be sufficient to isolate their Tx lines?

3. Is there anything else I should keep in mind regarding pullup or coupling resistors, etc.


Thx.


At the master use an AND gate for the signals coming from the slaves Tx. Use a pullup resistor on the inputs to the AND gate. That will take care of the signals coming from the slaves. At the slaves place a pullup resistor on the the slaves Rx. Use a transistor to pull down the voltage on the slaves Rx. Operate the transistor from the masters Tx.

For 2 to 8 feet this should be no problem at all. I would play with the pull up resistors to make it work at the desired baud rate. 5K should be OK.

RS485 can go for miles like this and its only 5 volts between the lines. The trick is in the pullup(terminating) resistors force a current signal.
jensen1d



Joined: 08 Apr 2005
Posts: 5

View user's profile Send private message

what about the software?
PostPosted: Thu Aug 11, 2005 4:41 pm     Reply with quote

So if I understand,
when PIC master Tx line drives the xsistor, the xsistor sees, say ~10 slave input resistors in parallel between the collector and +5.
At 10K each, total resistance is about 1K,... if Vsat on transistor is 0, then xistor draws 5 mA collector current. It seems the PIC could sink that...
So is xsistor a "sacrificial driver"?

One question remains regarding the software:

On input to Master, the AND requires all slave outputs high except the one that's transmitting.
What command should the slaves execute to ensure the idle Tx output pins stay high?
output_float(SLAVE_Tx_pin) ??
or
output_high(SLAVE_Tx_pin) ??


Also, an 11 input AND will require at least 2 external chips (8 inp and 4inp)
Is there a simpler way? I'm trying to reduce external part count.
Specifically,
Will output_float() and internal pullups on each slave output NOT work reliably assuming wirelengths are OK?

I realize this is a software board but these HW issues are messing w/ my SW.

Thx.
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: what about the software?
PostPosted: Fri Aug 12, 2005 8:50 am     Reply with quote

Your right the transistor is not really required. I suggest it because I dont know how many slaves you will use and dont know if the 10K pullups are low enough.

The Tx pin from the USART will idle in the highe state when its not transmitting.

I suppose you could use dioed's instead of AND gates but the USART module controles the pin when the module is enabled. I remember some kind of problem with manualy controling the Tx pin while the USART is enabled. So I don't know that you could float the Tx pin.
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