PDA

View Full Version : I2C and multiple slave



Zorglub
- 3rd April 2005, 12:22
Hi,

I have multiple applications with the 16F87.
I would like to connect all these applications together with the I2C bus with 1 master (16F877) and all the slaves (16F87).

How can I address the slaves independently ?

Best regards

NavMicroSystems
- 3rd April 2005, 13:33
Zorglub,

based on the information you have given the answer is:

By simply assigning the slaves address in the I2CWRITE / I2CREAD command.

Please see also THIS (http://www.picbasic.co.uk/forum/showthread.php?t=1254)

Melanie
- 3rd April 2005, 13:35
PICBasic only supports I2C Master mode for the Master PIC... you will have to write your own routines for the Slave Mode PICs.

NavMicroSystems
- 3rd April 2005, 13:54
Mel,

based on the information given one could assume he already has written the slave routines.

Melanie
- 3rd April 2005, 16:01
Well in that case addressing is the easiest part of all. Just assign some spare pins on the Slave PICs, ground some, and pull others up to V+ and they become the unique address for that PIC. That way, all your Slave PIC software remains the same, and when that PIC powers-up it determines it's own address. Thereafter, the Master just addresses the PICs as if they were standard I2C devices. Nothing could be simpler at that point.

Zorglub
- 4th April 2005, 10:01
Thank you,

Is the following another solution ? in the datasheet 16F87 :

Register SSPSR and SSPADD for chip addressing ????

Best regards

Luciano
- 4th April 2005, 10:22
Hi!

Maybe these links will help you.
(Search with Google for more).

Microchip Application Note AN734:
Using the PICmicro SSP for Slave I2C Communication
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011798

Picbasic Pro project for Slave I2C Communication:
http://www.astrosurf.com/soubie/pic_as_an_i2c_slave.htm
(See Microchip application note AN734 has errors).


Luciano