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

Trouble shooting I2C

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



Joined: 01 Feb 2006
Posts: 64
Location: England

View user's profile Send private message Visit poster's website

Trouble shooting I2C
PostPosted: Wed May 30, 2007 2:53 pm     Reply with quote

I found a couple of stumbling blocks using I2C, hopefully this post will stop other people tripping on them like I did.

1/ Don't try the I2C without the pull up resistors (4.7k Ohms), this will effectively hang the PIC which will require the watchdog to recover. Don't ask my why, it just does.

2/ Don't use the routine "setup_spi(FALSE);" as this will also the I2C working. I had copied the setup used on several other projects and didn't realise that this would cause problems... But it did.

For those who'll ask, compiler v3.249, PIC18F2680 & PIC18F258.

Cheers Scott
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 30, 2007 3:26 pm     Reply with quote

Reason why it hangs if you leave off the pull-ups:
http://www.ccsinfo.com/forum/viewtopic.php?t=30751&start=3

Reason why setup_spi(FALSE) disables hardware i2c:
http://www.ccsinfo.com/forum/viewtopic.php?t=29669&start=3
ferrumvir



Joined: 01 Feb 2006
Posts: 64
Location: England

View user's profile Send private message Visit poster's website

PostPosted: Wed May 30, 2007 3:56 pm     Reply with quote

Thanks for the info, I searched the forum before I discovered my errors and failed to find anything, I also searched before I posted, nothing.

This highlights my inability to know what keywords to search for!

Fingers crossed it'll help someone...

Cheers Scott
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