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

1-wire RS232
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
apl01



Joined: 18 Dec 2007
Posts: 18

View user's profile Send private message

1-wire RS232
PostPosted: Thu Dec 27, 2007 3:31 am     Reply with quote

Is there any way of using 1-wire for RS232 communication between many slaves and a master?

Thanks.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: 1-wire RS232
PostPosted: Thu Dec 27, 2007 6:50 am     Reply with quote

apl01 wrote:
Is there any way of using 1-wire for RS232 communication between many slaves and a master?
Thanks.


Yes, sort of. I wouldn't call it RS-232, though. It would be a non-standard asynchronous serial half-duplex link. Instead of the usual RS-232 driver chips, use a passive pull-up and let each transmitter pull down the wire with an open collector or open drain. Your protocol will have to ensure that the master and slaves know when it is OK to transmit so they do not try to transmit at the same time. There is no reason to try to use RS-232 voltage levels, so you might as well use logic levels that are the same as your PICs. Since there is only one wire for both sending and receiving, each node (whether master or slave) will see its own transmissions echoed in its receive buffer. So you will have to be smart enough to recognize and discard those received characters. Other than that, and the loss of bandwidth that comes from using a passive pull-up system, there is no reason why this could not be used.

Robert Scott
Real-Time Specialties
Embedded Systems Consulting
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 8:23 am     Reply with quote

I use a single TTL serial line to communicate between instruments on the bottom of the sea, where fortunately there is little electrical noise. Each end of the line has a DC blocking cap 1.0uF in case the cable gets mis-wired, and a series 50 Ohm termination resistor to the PIC pin. There is also a 10k pull-up resistor so the line idles as a stop bit, and a 0.01uF bypass cap to ground to kill noise from other wires in the cable..
The master sends a command and the slave responds. The slave never speaks unless spoken to. 1200 baud runs reliably over 1000 meter 24 AWG cables.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Guest








Sherpa...
PostPosted: Thu Dec 27, 2007 2:12 pm     Reply with quote

Hey I think I just put it together...

After years of reading about your interesting undersea projects...

Then I see Cape Cod on your profile - I'll bet you work for or at Woods Hole?

I was there several times - a nice little town.

:-)

Steve H.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 3:05 pm     Reply with quote

Like most of the engineers on Cape Cod I have at one time worked for the Woods Hole Oceanographic Institute. Now I am a consultant working for several oceanographic and ship husbandry companies. The oceanographic work is interesting, but the commercial shippers have the money.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Steve H
Guest







PostPosted: Thu Dec 27, 2007 3:46 pm     Reply with quote

Well I was close!

:-)

Steve H.
custom_elect



Joined: 15 Dec 2007
Posts: 13

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 6:45 pm     Reply with quote

Yes - I am an old dude.
But over 30 years ago - Intersil published a great 1 wire addressable half-duplex opto-isolated data aquisition network, the basis of which was used in many a good remote process control DATAQ system.
If you get stuck - email and I'll send some circuits.
roger@custom-electronics.co.uk
apl01



Joined: 18 Dec 2007
Posts: 18

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 10:34 pm     Reply with quote

OK so it can done. What do you mean by passive pull up system? I was thinking of making both master and slaves always in the receiving state by making the Tx pins as inputs i.e input(Tx). When the slave or master wants to send data the Tx pin becomes active sends data then resorts back to an input. Being new to comms would this work?

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 11:55 pm     Reply with quote

Also see these two CCS example files:
Code:
c:\program files\picc\examples\ex_pbusm.c   
c:\program files\picc\examples\ex_pbusr.c   
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

1 wire
PostPosted: Fri Dec 28, 2007 12:43 am     Reply with quote

as you say.
both TX input on start
TX and RX lines connected together
10k pull-up resistor on the line
difficult to chek if the line is active not to have bus colision
if one is master and others slaves, the master should manage the bus.
master transmits 55h,AAh,slave address, read/write &number of bytes for example, clear the bus. slave answers and clear the bus
joseph
custom_elect



Joined: 15 Dec 2007
Posts: 13

View user's profile Send private message

PostPosted: Fri Dec 28, 2007 6:07 am     Reply with quote

But you have to be real careful about what happens when the power goes off one device - you dont want it to jam up the whole comms bus. Opto isolators are the answer.
Audi80



Joined: 07 Sep 2007
Posts: 41

View user's profile Send private message

PostPosted: Fri Dec 28, 2007 7:31 am     Reply with quote

For more than one slave you have to use RS485 or you wont get any communication. Because RS232 is a serial port witch means that you have to put all devices in serie and with RS485 you use a parallel port with means that all devices are in parallel. And dont forget that with RS485 you can only connect 32 devices. Wink
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Dec 28, 2007 8:41 am     Reply with quote

apl01 wrote:
OK so it can done. What do you mean by passive pull up system? I was thinking of making both master and slaves always in the receiving state by making the Tx pins as inputs i.e input(Tx). When the slave or master wants to send data the Tx pin becomes active sends data then resorts back to an input. Being new to comms would this work?


The problem is when both ends are inputs and the line is floating. If it happens to float to a Start bit voltage both ends will think the other has begun a sending a byte. They will both start clocking in serial bits till they get to the Stop bit when they will probably get a framing error. Avoid all this by rigging a resistor to pull the line to the Stop bit voltage when not being driven by anything else.
_________________
The search for better is endless. Instead simply find very good and get the job done.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Dec 28, 2007 8:46 am     Reply with quote

custom_elect wrote:
But you have to be real careful about what happens when the power goes off one device - you dont want it to jam up the whole comms bus. Opto isolators are the answer.


If the master powers the pull-up resistor and the slaves all use open collector (or open drain) output drivers and high impedance inputs, then only the master must have power for the bus to function.
_________________
The search for better is endless. Instead simply find very good and get the job done.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

1 wire rs232
PostPosted: Fri Dec 28, 2007 12:53 pm     Reply with quote

rs485 has +tx/+rx & -tx/-rx lines and select between tx and rx by software and hardware
1 wire rs232 has tx/rx line and select by software
they are the same. you can put the slaves in parallel in rs232 same as in rs485 or TTL levels. no difference.
and the line can't float if have 10k pull-up resistor
joseph
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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