View previous topic :: View next topic |
Author |
Message |
russk2txb
Joined: 30 Mar 2008 Posts: 109 Location: New Jersey
|
Revisiting I2C Slave, multiple addresses |
Posted: Tue Jan 19, 2010 12:48 pm |
|
|
Hi All. Last July I was asking about this and resolved it on a temporary basis, but now it has reared it's ugly head again. I am using the 18F6723 PIC to read 2 I2C addresses as slaves, but now I need to handle 3 slave addresses with the same pic. Looking at what Microchip has, they do not seem to have anything that can do more than two x I2C except by going up to the PIC24 line. But those devices do not have any onboard EEPROM! Seems strange. Anyway they are not suitable for that reason.
So, one obvious answer is to put 2 PICs on the board and get them to talk to one another. But before I give up on the one processor approach, I wonder if anyone has any other ideas. I have been told that doing software I2C for slave operation is not possible. And it also appeared that it is not possible to receive data from two addresses on the same set of I2C lines. Using STREAM?
Any help?
Thanks, Russ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 19, 2010 3:13 pm |
|
|
Quote: |
I am using the 18F6723 PIC to read 2 I2C addresses as slaves, but now I
need to handle 3 slave addresses with the same pic.
|
Do you mean that you need to make 3 i2c slaves, on 3 separate i2c
busses, inside one PIC ? What do these slaves do ? |
|
|
russk2txb
Joined: 30 Mar 2008 Posts: 109 Location: New Jersey
|
Revisiting I2C Slave, multiple addresses |
Posted: Tue Jan 19, 2010 3:39 pm |
|
|
Hi again PCM Programmer. Yes, my job is to emulate three ePots that are I2C slaves, each with a different address. So with two MSSP units I can only emulate 2 of the ePots - unless someone here knows a way. PIC24 devices have more than two I2C channels, but they do not have EEPROM and they also only have 10 bit A/D and I need the 12 bits provided by PIC18.
I'm currently thinking I will have to use a second PIC. In that case I guess using software SPI would be a good way to synchronize.
Your thoughts? |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Jan 19, 2010 4:11 pm |
|
|
The PIC24 I2C slave interface has an address masking option, that allows to accept multiple addresses. |
|
|
russk2txb
Joined: 30 Mar 2008 Posts: 109 Location: New Jersey
|
Revisiting I2C Slave, multiple addresses |
Posted: Wed Jan 20, 2010 2:45 pm |
|
|
FvM, ok on the address masking. I have studied the Microchip data sheets and cannot be sure I am correctly understanding how address masking works. It appears that when you set an address mask, the chip will respond to any address in the mask range, as one would expect. But I do not see any way for the programmer to determine which address in the range was matched. Without that capability it is of no use to me.
Can you tell me if the above is correct, or am I missing something?
Thanks, Russ |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Jan 20, 2010 3:24 pm |
|
|
Quote: | Can you tell me if the above is correct, or am I missing something? |
The latter. You may want to read the PIC24F Family Reference Manual I2C chapter more thoroughly to understand
the device operation. Generally, address data are transferred to the receive buffer and can be checked by your application. |
|
|
|