PDA

View Full Version : Adding a pic in I2C network....



robert0
- 28th April 2005, 18:57
Hi,


In a given environment i'm using a Pic16f876 and a I2C connection to read a memory and driving a Pcf8574 with 8 leds.
Now i have to add a new pic (pic16f84) and it seems to me the more logic solution to connect it in the i2c network.This new pic must continuosly read RF incoming data and send them to the "old" pic creating an interrupt.

Well, never found a real example on how I2cWrite and I2cRead work between pics.Could you point me????What is the "control" ,i mean the address, on a pic?
thanks.
robert0

BigWumpus
- 1st May 2005, 20:25
Hello,

your 16F876 ist the master,
the Pcf8574 seems to be the slave.

So your 16F84 is another slave !!!!!
Your master has to poll the new slave !!!! No Interrupt !!!!

robert0
- 2nd May 2005, 09:20
Thanks for your help.

Polling continuosly isn't the best (i think) but which serin and serout command?I mean how can both recognize each other?
pcf8574 has a built in address(btw is 01110000) but how about the pics?
roberto

Melanie
- 2nd May 2005, 12:07
PICs can only act as MASTER using PICBASICs IC2READ and I2CWRITE commands.

If you want to use a PIC as a SLAVE, then you need to write your own routines to do that. You can then assign whatever address you want to your SLAVE PIC - they don't come with a pre-assigned I2CSLAVE address because they don't come with integral I2CSLAVE software. It's up to YOU to create that software.

I would refer you to Microchip Application Note AN734...

http://ww1.microchip.com/downloads/en/AppNotes/00734a.pdf

But don't blindly copy it without understanding... there's some serious errors and omissions (as most Microchip Application Notes seem to have) that will prevent the code from operating correctly. However the theory is reasonably all in place.