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

Using Hardware i2c as slave and a software i2c as Master

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



Joined: 15 Jun 2011
Posts: 1

View user's profile Send private message

Using Hardware i2c as slave and a software i2c as Master
PostPosted: Wed Jun 15, 2011 1:27 pm     Reply with quote

Hi

In a current project I need to be communicating to a few devices via i2c, but my PIC18F2455 is already a i2c slave.
The documentation mentions for i2c FORCE_SW. Is it possible to do the following:

Code:

#use I2C(slave,sda=PIN_B0,scl=PIN_B1, FORCE_HW)
#use I2C(master,sda=PIN_B5,scl=PIN_B6, FORCE_SW)


Would you need to write any code in order to make the master part work?

Best regards
Jakob
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 15, 2011 2:01 pm     Reply with quote

You should add the stream parameter to each one and give each
stream a unique name. Then use the stream ID in i2c_start(),
i2c_write(), i2c_read(), i2c_stop(), etc.

Also, you are using the debugger's clock pin (Pin B6) for the Master,
so don't expect to be able to debug the program with your ICD.
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