I2C PIC-to-PIC

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Neon27
Posts: 6
Joined: Mon Aug 02, 2010 9:18 pm
Has thanked: 1 time
Been thanked: 2 times

I2C PIC-to-PIC

Post by Neon27 »

Good day!

I have a prototype with several modules, each containing a PIC micro-controller. The whole system is controlled by a central module, yes, another PIC. All the PIC's are wired to a single I2C bus.

I would like to set the PIC in the 'central module' as a Master, and all the surrounding modules as Slaves.
I've seen a lot of I2C Flowcode examples for PIC's communicating with eeproms and sensory modules, but none concerning two PIC's. Maybe I couldn't find the article?

What would be the best Protocol to use when sending data between the Master and a Slaves? I've come-up with the following:

1. Master sends slave address onto I2C bus.
2. All slaves are listening, so the slave with matching address prepares for incoming data.
3. Master sends data.
4. Slave sends data.
5. Steps 3 & 4 are repeated several times as the PIC's exchange information.
6. Process ends, all Slaves return to 'listening'.

I'm not exactly sure how to work the ACK's and NACK's, what would be the best approach to setting-up the blocks in Flowcode?

I'm using Flowcode V3

Any advice appreciated!
Thanks,
Ed

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C PIC-to-PIC

Post by Benj »

Hello Ed,

I think this is the topic you are looking for.

http://www.matrixmultimedia.com/mmforum ... ave#p17145

The specific protocol is really up to you but the one you are currently implementing looks quite good.

Neon27
Posts: 6
Joined: Mon Aug 02, 2010 9:18 pm
Has thanked: 1 time
Been thanked: 2 times

Re: I2C PIC-to-PIC

Post by Neon27 »

I know this is a late response (that's an understatement... I've since used V4 & V5)
Just wanted to say thanks!! :D

Post Reply