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 CCS Technical Support

I2C Slave: Detecting stop bit from master-transmitter

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



Joined: 28 Jul 2010
Posts: 10

View user's profile Send private message

I2C Slave: Detecting stop bit from master-transmitter
PostPosted: Thu Dec 30, 2010 2:37 pm     Reply with quote

I have a master that is transmitting a variable length sequence of bytes to a slave.

I am wondering if there is any way for the slave to detect when it has received the last byte of the sequence.

I have considered using a count or termination byte but would prefer to avoid those approaches.

Any examples or tips would be greatly appreciated.

I am using compiler version V4.108

Thanks.
temtronic



Joined: 01 Jul 2010
Posts: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Dec 30, 2010 3:17 pm     Reply with quote

You could trigger a timer watchdog subroutine, that starts when the slave sees data coming...then sets a flag 'no more data' when the data line goes idle longer than the pulse width of the data bits.

As you know the I2C bus rate in KHz, figure out the bit rate, set WDT for 1.5 to 2 bit widths. Try it and 'fine tune' as required.

It's a simple, effective way to do what you want and I've done it for almost 3 decades with up to 255 slaves per master so I know it does work!
xlh1460



Joined: 28 Jul 2010
Posts: 10

View user's profile Send private message

PostPosted: Thu Dec 30, 2010 4:19 pm     Reply with quote

I was thinking more along the lines of solving this just using the MSSP module.

I have made some progress but I am starting to think your approach may end up being simpler.

Thanks.
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