|
|
View previous topic :: View next topic |
Author |
Message |
Triffon Guest
|
Using I2C in slave mode on a 16F877a |
Posted: Wed Mar 24, 2004 4:18 pm |
|
|
Hi,
I am using the following directive for my slave mode PIC to use I2C :
#use i2c(Slave,Slow,sda=PIN_C4,scl=PIN_C3,address=0x0A)
The question I wonder is the following :
#int_SSP
SSP_isr()
{
// blah blah
}
Is the SSP_isr interrupt called when a byte is incoming for MY pic on the I2C port (ie is the byte intended to be read by me, that is to say has the destination address already been decoded by the I2C software provided by the compiler or not ?) or when a byte is incoming, whether it is for my pic or not (ie is the byte intended to be read by another slave on the network, that is to say : have I got to decode the destination address by myself ?) ?
I'd be glad to see some sample slave code in a multislave I2C network ;p
Another question : Can the I2C software provided by the compiler be used when in slave mode ?
Thanks |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Wed Mar 24, 2004 4:40 pm |
|
|
You will get the interrupt only when 1)the data is meant for your PIC, 2)the master has issued a General Call Address. Quoting from the datasheet: "When the interrupt is serviced, the source for the interrupt can be checked by reading the contents of the SSPBUF to determine if the address was device specific, or a general call address."
And no, the software I2C only works in the master mode. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|