|
|
View previous topic :: View next topic |
Author |
Message |
pebbert9
Joined: 31 Dec 2010 Posts: 39
|
I2C Slave End of Transmission |
Posted: Wed Aug 31, 2011 4:26 pm |
|
|
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
|
|
Posted: Wed Aug 31, 2011 4:49 pm |
|
|
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(). |
|
|
|
|
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
|