PDA

View Full Version : Two pics in a I2C bus?



robert0
- 4th January 2006, 12:53
Hi,
is it possible to have two pic16f628 reading and writing a 24c08 memory on a I2C bus?

I mean what kind of circuitry i'd need ,or a simple i2cwrite and i2cread on a simple I2C two-wires bus could do the job?

Thanks
roberto

P.S.

obviously any kind of schematics will be very appreciated.

Melanie
- 4th January 2006, 13:07
You can connect multiple Masters (PICs) on an I2CBus as long as only ONE is allowed to use the bus at any one time. The others should have their I2C pins switched to INPUT when not in use. A third (common) line is required between the Masters to indicate that the bus is busy. Everything else you can do in PBC or PBP.

robert0
- 4th January 2006, 13:28
Thanks Melanie for your prompt reply.

You mean that i have to add a line between the PICs and (i.e.) rise it when a PIC is reading or writing on the bus ,so the other ( with input pins)must wait for the low line for accessing the bus ( the bus is free).Is it correct?

And sorry but due to my poor english i cant understand well this sentence:

"Everything else you can do in PBC or PBP."

Do you mean that it's all i can do with picbasic?

Thanks again
roberto

Melanie
- 4th January 2006, 13:44
Example Schematic appended...

I have chosen the PIC port pins randomly, you can use whatever pins suit your design. All Resistors 4K7, all Capacitors 100n. There are three connections on our I2C bus now, SCL and SDA as per usual, and we have added SBS.

I mean that you CAN do it all with PBC or PBP without difficulty. Use the third SBS (Busy) connection to indicate to the other PICS/Masters that the bus is busy and they should wait.