CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Using I2C in slave mode on a 16F877a

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Triffon
Guest







Using I2C in slave mode on a 16F877a
PostPosted: Wed Mar 24, 2004 4:18 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Mar 24, 2004 4:40 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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