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

Connecting multiple PIC MCU's

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



Joined: 24 Apr 2014
Posts: 138

View user's profile Send private message

Connecting multiple PIC MCU's
PostPosted: Tue Mar 23, 2021 12:56 pm     Reply with quote

Hi All,

I'm updating the design of some test equipment, and I need to be able to pass 8 bytes of data to a 'Master' from up to four 'Slaves'. Data rate can be quite slow (19,200 baud or so). I'm envisioning a daisy chain type interconnect cable for the physical wiring connection. Each instrument can be up to 5 feet distant, so the maximum distance from the Master to the farthest Slave is 15 feet. I considered RS485, but I'm not sure how I'd handle the buss termination when I'm never sure where the 'end of the line' is based on the number of connected instruments. I suppose I could specify that the end connector always be used, but I want to make this totally idiot proof!

I've never used I2C for this type of communication. The specs. look promising. Is I2C a viable option for this type of thing?

What about SPI?

So, looking for suggestions on the method/protocol that will provide a simple, yet robust inter-board communications for up to four boards each spaced 5 feet apart.

Thanks,

Jack
temtronic



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

View user's profile Send private message

PostPosted: Tue Mar 23, 2021 2:22 pm     Reply with quote

Given the choices, go with RS-485. Easily handles the distance/speed criteria. CCS has a 'driver/example' program you can start with. Easy to add more 'slaves'.
If the slaves will be powered from the Master, then RJ-45/CAT5 makes great connection/cabling. Cheap, quick install,reliable. if you deign the I/O of the slaves with 'in' and 'out' connectors on opposite side, the 'termination' goes in the last slaves 'out' connector. When you need to add #6, remove term plug form #5, add cable, #6, then install 'term plug' into #6 'out'. Easy and simple.
BTW ...19K200 isn't 'slow' to me, it's 800X faster than my energy systems run.

Both I2C and SPI are 'board level', not designed for distance, more for speed (which you don't need).
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Wed Mar 24, 2021 1:57 am     Reply with quote

Absolutely.
If you want to take I2C, more than about 5 feet, you start having to
use extra transceivers and a higher signalling voltage. Otherwise reliability
plummets. More complex than RS485.

I'd suggect you just make the boards each have an in and out connector.
Then have a plug with a terminating resistor that you plug into the end
unused 'out' connector.

There are two parts to termination. The signal reflection, and the bus
biasing. Just have biasing in the master board. Then the reflection is
down to simply having a resistor between the two signals that is close
to the characteristic impedance of the cable, at each end of the bus.
So for perhaps a 100R cable use resistors between perhaps 100R and 120R.

Both SPI, and I2C, are designed as local busses only. They are not
suitable in any way for communicating more than a few inches really.
bkamen



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

View user's profile Send private message

PostPosted: Wed Mar 24, 2021 2:24 pm     Reply with quote

Consider checking out:

https://www.ti.com/lit/an/slla272c/slla272c.pdf
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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