Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Communication between one PIC and many PICs

Status
Not open for further replies.

Futterama

Member
Hi there,

I have a project where one master PIC needs to communicate with many (5-10pcs) slave PICs. The master PIC will be placed around 1 meter from the first slave PIC and the slave PICs will be spaced with 1 meter each in a straight line.

I need ready made cables and connectors and found 1 meter RJ-45 network cable to be pretty cheap along with plastic RJ-45 connectors.

What would be a good choice for communication?

My thoughts are:

1. Could I connect the slave PICs to the cable and just "sniff" the data (is that what they call multidrop bus?) or should I use daisy chaining? Would I need some kind of termination if not using daisy chaining?
2. Could I connect the PIC USARTs directly through the cable or should I use tranceivers (RS-232 or RS-485) even on these short distances?

Speed requirements: The master needs to poll all the slaves in turn and should be able to poll 10 slaves in 10ms. Polling is just asking for data (maybe just a 1 byte address) and the slaves would respond with 4 bytes data.

Reliability and pricing is important, I guess reliability could be secured using checksum for the data and cheap transceivers or even no transceivers would keep price down.

The PIC device has not been selected yet, so I'm open for suggestions.

I have been using RS-232 and RS-485 before and knows how the hardware works, but I'm open for other options as well.

Edit: The slave PICs are connected to some other device that needs 3V supply, so 3V supply would be ideal. Also the cables needs to supply the power but I guess that's not a problem with 8-wire CAT5 cables, but I don't know how the supply should be connected in the cable because of the twisted pairs.
 
Last edited:
I'm thinking RS-485 and RS-422 would be the simplest networks and protocols to configure. They're setup for multi-point communication and the programming overhead is minimal. The data rates aren't as fast as ethernet and other options.

RS-232 really is a point-to-point communication, though you can adapt it. But then you're making your own transceiver and data protocol which would not be compatible with anything else on the market down the line.
 
Isn't I2C an option?

Tried it in a one to one connection only.
 
I found a pretty cheap RS-485 transceiver: **broken link removed**
The above transceiver got a nice feature:

"Slew Rate Limited Versions for Error Free Data Transmission (ISL83483, ISL83488) . . . . . .up to 250kbps"

It won't even need termination and I can use it in multidrop mode (no daisy chaining).

I guess this settles it then: RS-485.

But what about supplying power over the twisted pairs in the cable? The RS-485 would need 2 pairs, then I have 2 pairs for VCC and GND. How should this be connected to the pairs to have the least influence on the data pairs?
 
I2C, well yes, I only worked with it once several years back and really didn't like it because it is kinda complicated. Would I2C require transceivers?
 
I2C, well yes, I only worked with it once several years back and really didn't like it because it is kinda complicated. Would I2C require transceivers?

I2C is a BAD choice - overly complicated - a simple serial protocol is easy to do, and you can simply chain the devices in series (UART out from one device to the next). Each PIC simply echos the received byte out to the next one - the return path could simply be from the very last PIC back to the master.

A lot depends really what you're trying to do?, and what data scheme you come up with.
 
I like I²C as many pics have it available in hardware. However, in this case I'd avoid it as it's really for short data paths.

Hmmm, where did all those symbols go to? Like ²?

Mike.
 
Pommie:
Give us some more details and possibly provide a routine for tiny PIC's that don't have any built-in features, so he can run his project with 45cent chips.
 
Pommie:
Give us some more details and possibly provide a routine for tiny PIC's that don't have any built-in features, so he can run his project with 45cent chips.

For I2C slave you really need it in hardware, master is fine in software - but reliable slave is a lot more difficult.
 
I have decided to use the EUSART on PIC16F1823 with the Intersil RS-485 transceivers. The PIC also have the MSSP for SPI I need.

The question about which wires from the available 2 pairs I should use for power + GND is still unanswered.
 
Master and slave in software (Based on Nigel's ?)

I recall doing I2C between two PICs in software for both.

Found it not hard.

Have no time to check it right now , but I vaguely suspect that could have been done based on Nigel's examples? Is that possible? What if not with the 16F84A!!

I will try to revert on this soon. I know I have the soft available.
 
Last edited:
With the EUSART on PIC16F1823 I think you can use 9 bit mode. The master sends a address command out with bit 9=0. The slaves check all data and only respond of bit 9=0. All data from master or slave will have bit 9=1.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top