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

I2C Slave End of Transmission

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



Joined: 31 Dec 2010
Posts: 39

View user's profile Send private message

I2C Slave End of Transmission
PostPosted: Wed Aug 31, 2011 4:26 pm     Reply with quote

Hello,

Is there a way for an I2C slave to tell when transmission has ended?

I wish to have an I2C master send multiple bytes ( up to 32 ) to an I2C slave, and I don't want to send the address before each byte.

I have an interrupt on the I2C slave writing incoming bytes to a buffer but I need to determine when the last byte has been read.

Thank you,
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 31, 2011 4:49 pm     Reply with quote

I haven't done this, but looking at the 18F4620 data sheet, I see there is
an option to setup slave mode so it interrupts on the start and stop bits, in
addition to the address and data bytes. When the i2c master is done
sending bytes to the slave, it always sends a stop bit. So, at the start of
the #int_ssp isr, you could read the SSPSTAT register and see if the
interrupt was caused by either of those two things and act accordingly.

CCS doesn't appear to have a #use i2c() parameter to enable this mode,
so you would have to modify the SSPCON1 register in code. Do this
near the start of main().
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