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_read function dsPIC30F6014 - now works

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



Joined: 15 Jul 2010
Posts: 1

View user's profile Send private message

i2c_read function dsPIC30F6014 - now works
PostPosted: Thu Jul 15, 2010 1:58 am     Reply with quote

Hi!

I had a problem working with function i2c_read (on dsPIC30F6014) while i2c_write was working fine... dsPIC was a master and FRAM FM31278 was a slave.

So, I solved the problem and here is the solution if anyone needs it.

To configure dsPIC I2C module I used this line:
Code:

#use i2c(master, sda = PIN_G3, scl = PIN_G2, force_hw)

But, this way or any other way, as far as I know, using "use" directive you cannot disable General call option of I2C module. Anytime dsPIC sent byte 0x00 the RBF flag was set and next time the I2COV flag too. This happens because of the fact that anytime the byte 0x00 is sent this is seen as General call by I2C module. It doesn't matter if the byte was sent following the i2c_start call or later.
When this occurs i2c_read function doesn't work (it returns 0 or -1).

So, I did the following:
Code:

#word I2CCON = 0x0206
I2CCON &= 0x0xFF7F; // General call disabled

Greetings,
Milan
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