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

universal RS232 communication protocol between controllers
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Sun Jun 02, 2013 2:44 am     Reply with quote

Worth remembering, that if you have even one 'extra' line available, you can just use a hardware CS.
This is how multi device SPI is done. The master drops the CS for the device it wants to talk to and the hardware buffers for this device 'only' are turned on.
So (for instance), if the connections are short range, you can simply use a logic gate to connect the 'master' RX/TX to the device you want to talk to. With just two devices, you can just have a single line that you take high/low, to select which device you want.

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Jun 02, 2013 3:12 am     Reply with quote

Quote:
Usually I`m using parallel data transfer which is 99% reliable but it demands a lot of wires and pins. So I want to use something more complex but with same reliability...
This is exactly what I was afraid of...
You haven't told us what you want to achieve with your question and now the question goes a whole different direction.

Serial communication can be faster and even more reliable than parallel communication. That's one of the reasons connection to the hard disk in your PC has changed from parallel (PATA) to serial (SATA).

Please understand that there are many different serial standards, you don't have to invent your own version as it is very likely an off the shelf version exists. But.... the reason there are so many different versions is because none of them is perfect, each one is optimised for a dedicated purpose.

Just to give you an impression of some of the most used serial buses in a PIC environment:
- RS-232: uses +/-15V, 1-to-1 connection, max. distance about 15m (depending on baud rate and cable quality), max. baud rate 1Mbit
- RS-422: differential voltage +/- 6V, 1-to-1 connection or multidrop (1 sender, max. 10 listeners), max. distance 1500m, max. baudrate not specified but depends on line lenght (10Mbaud at 12m)
- RS-485: differential voltage (200mV), 1-to-1 connection or multidrop (1 sender, min. 32 listeners) or multipoint (many-to-many) connection, max. line length and baudrate not specified but depend on line length: 35Mbit at 10m, 100kbit at 1200m.
- SPI: short distance (on same PCB), max. 100Mbit (?)
- I2C: short distance (on same PCB), max. 400kbit
- CAN: for harsh environments (vehicles), max. 40m and max. 1Mbit
- LIN (Local Interconnect Network): a simpler alternative to CAN for use in vehicles
- USB
- Ethernet

We can help you make a choice between these buses but then you have to give us more details:
- Desired maximum distance
- Desired maximum baudrate
- point-to-point (1-to-1), multidrop (1-to-many), multipoint (everyone can talk to everyone)
- Network topology: is it a bus, star or ring layout?
- special wishes? (for example harsh environment like a car?)
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Sun Jun 02, 2013 6:09 am     Reply with quote

I need multipoint bus. The distance is 5m from point to point but it has to be bus topology. Baud rate atleast 19200. May be harsh environment - it`s not necessary but I want to ensure the transfer.
I want the schematics to have the ability new controllers to be added if necessary.
I starting to think about CAN or Modbus.
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jun 02, 2013 6:57 am     Reply with quote

You might want to spend a day or two and mockup say 3 RS-485 nodes. Easy to implement and test some basic code.

Both Modbus and CAN are 'memory/code' top heavy and may be overkill for your application. They will cost more(some PICs have CAN inside).

Most of my time is spent doing 'proof of concept' testing in the real environment of the product. Everything works fine on paper and the bench BUT when you toss the product 'out there' is where it HAS to work !

hth
jay
asmboy



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

View user's profile Send private message AIM Address

PostPosted: Sun Jun 02, 2013 1:00 pm     Reply with quote

are all your nodes 'peers' ??
or
is there a delineation of function into
master /slave ?

is it useful/ convenient for you
to have a PC as a master ?

in either case some form of RS-485 physical layer
is probably your best bet, whether you use
Modbus protocol on it or not.
---yet----
now - don't laugh - but in reality , if 5 M was max distance i would be tempted to actually use some very simple CMOS gates......as a common HUB for all that RS232 , where the CMOS is used to AND - all the TTL TX
lines into a single combined TX - then use HC541's with inputs all tied to the OUTPUT of the AND tree - to feed all the RX inputs

if the protocol is to only "speak when spoken to"' - this can work VERY well.
i know because i have used that method in a complex instrument where 8 PICS must communicate with a common host PC - .

each pic has 3 pins with pullups and DIP switches that set its listen address, and all communication begins with an 'address' command to select the pic that will be subject to doing the master's bidding, and returning data to the master..

if you have PURE peer 2 peer - with no designated master- then forget it - this will not work so well .. my 2 cents
jds-pic



Joined: 17 Sep 2003
Posts: 205

View user's profile Send private message

PostPosted: Wed Jun 05, 2013 7:45 am     Reply with quote

OP:
see my posts in this thread,
http://www.ccsinfo.com/forum/viewtopic.php?t=25980

including
http://losdos.dyndns.org/public/pic-uC/cbus-protocol-spec-draft-rev1.pdf

jds-pic
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 Previous  1, 2
Page 2 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