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 Multi-byte Slave to Master?

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



Joined: 15 Mar 2005
Posts: 12

View user's profile Send private message

I2C Multi-byte Slave to Master?
PostPosted: Mon Apr 18, 2005 2:47 pm     Reply with quote

Is it possible to program a I2C Master-Slave system with multi-byte Slave to Master communications with the compilier I2C_XX() functions? If so, could code snippets be posted?

I have no trouble with multi-byte Master to Slave communications, but going the other way, things are limited. Following a Master I2C_Write() with the seven bit address and LSB set followed in the Master with an I2C_Read (), I can communicate a single byte from the from the Slave with a I2C_Write() call. The Master does not Acknowledge, and investigation with a scope shows the SCL line remains low, which renders my I2C bus in an permanent "Clock Stretching" mode.

I've tried a days worth of various register twiddling in conjunction with the I2C_XX() function calls to no avail. Can multi-byte Slave to Master be done with the high level compiler functions? Searching this forum shows only code examples with elaborate register bit manipulation claiming multi-byte Slave to Master communications. Is this the only way to get this done?

Thanks for any advice, or hopefully code.

Doug
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Apr 18, 2005 5:41 pm     Reply with quote

Did your slave transmit any more data?? The slave was holding the clock low waiting on you to do another write. You have to check the return value of the I2C_Write to see if the slave is supposed to continue writing. Take a look at this old post where I modified the CCS example program to do what you want. Note the ssp int can be quite long doing it this way and I wouldn't do it but you can do it as a test. I would probably set a flag and handle it in the main loop.

http://www.ccsinfo.com/forum/viewtopic.php?p=6851#6851
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