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

Quick question on I2C?

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



Joined: 14 Jun 2006
Posts: 31

View user's profile Send private message

Quick question on I2C?
PostPosted: Fri Jun 16, 2006 2:21 pm     Reply with quote

Hello,

I am a <newbie> to the CCS and the PIC world. I just got the CCS kit for the PIC16f877A micro controller a few days ago and I am doing chapter 17 (using an I2C temperature sensor).

Q#1:
If this sample claims to be using I2C, then why is it not using the appropriate pin outs of the chip? Pinouts for I2C on the PIC of package (44Pin PLCC) are pins 25 and 26 or RC4 and RC5 respectively.

But the sample in out exercise booklet is using pins B0 and B1 which are simple digital IO pins.

confused!

Any help or clarification for this is very appreciated!

Thanks

Regards
Roberto!
cmdrdan



Joined: 08 Apr 2005
Posts: 25
Location: Washington

View user's profile Send private message

PostPosted: Fri Jun 16, 2006 2:42 pm     Reply with quote

Rougie --

I don't have the CCS board, nor do I know what all is on it. The pins slated for I2C on the PIC may be in use for other purposes, but for the purpose of your exercises, it doesn't matter.

If you use the hardware-defined pins for I2C, the compiler will generate code to use the internal I2C hardware. If you use other pins, the compiler generates code to "bit-bang" those pins to effect I2C. In this manner, you can use I2C on devices that don't have on-chip I2C capability, such as the 12F675.

Hope this helps! Make sure that you have pullup resistors on the lines for SCL and SDA, and have fun! Welcome to the world of PICs!

Dan
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Fri Jun 16, 2006 2:56 pm     Reply with quote

Software I2C signals can be used on almost any pin as long as the PIC is used as the Master. A PIC configured as a Slave is much more complicated in software mode. It sounds like the PIC will be the Master so there's no worry there. Simply have the proper pins assigned in the #use i2c statement and you should be fine.

Ronald
rougie



Joined: 14 Jun 2006
Posts: 31

View user's profile Send private message

Thankyou!
PostPosted: Fri Jun 16, 2006 3:08 pm     Reply with quote

A million thanks guys, you have cleared it All up!

Kind regards
Roberto!
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

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

PostPosted: Fri Jun 16, 2006 3:09 pm     Reply with quote

cmdrdan:
The help manual says...
Quote:
Software functions are generated unless the FORCE_HW is specified.


To me this means it is unrelated to which pins are picked.
So I think you need to say force_hw or you will get the bit-bang.


BUT i didn't look at the code listing to make sure.
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