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

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



Joined: 24 Apr 2010
Posts: 75
Location: Islamabad

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

i2c
PostPosted: Thu Aug 05, 2010 8:39 am     Reply with quote

Hi. I am using pic16f877a and I have already utilised i2c pins (C3 and C4) with a EEPROM 24c256.
Now I want to use a real time IC DS1307.
My question is can I use any I/O pins for i2c protocol or can I only use one i2c supported device with my one PIC16f877a ?
_________________
...
Ttelmah



Joined: 11 Mar 2010
Posts: 19505

View user's profile Send private message

PostPosted: Thu Aug 05, 2010 8:54 am     Reply with quote

You can use other pins, using software I2C, but you can equally well just attach the RTC, to the same I2C bus you already have. This is why I2C devices have addresses. So long as they differ, there is nothing to stop you having half a dozen different I2C devices on the one bus. The DS1307, uses addresses 0xD0/D1 (using 8bit addressing), while a 24C256, will use 0xA?, with the '?', depending on the voltage pattern you have on the A0 to A2 pins. These will be quite happy to co-exist on one bus....

Best Wishes
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Aug 05, 2010 11:50 am     Reply with quote

You can have multiple I2C busses on the same PIC BUT you should only use the hardware I2C if the PIC is acting as a Slave. The slave device needs the hardware I2C to recognise the address that the master is sending out. Software I2C for a slave gets way too messy and complicated.

I have a device that has a Master PIC that talks with multiple Slave PICs. Each slave PIC utilizes the hardware I2C port to talk to the master. Also, each slave PIC has a separate software I2C bus that bit-bangs a sensor. So, this PIC is using a hardware I2C and a software I2C. The slave just acts as a master when it's talking to the sensor.

Ronald
Bilal



Joined: 24 Apr 2010
Posts: 75
Location: Islamabad

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

PostPosted: Fri Aug 06, 2010 5:45 am     Reply with quote

Thanks buddyd.
Ttelmah please can you tell me more about addresses. I can't understand fully.
_________________
...
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