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

I2C + use fast_IO + set_tris_c()

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



Joined: 19 Oct 2004
Posts: 40

View user's profile Send private message

I2C + use fast_IO + set_tris_c()
PostPosted: Tue Mar 04, 2008 8:20 am     Reply with quote

Hello
I am going to develop a I2C communication and I was wondering if I can use : use fast_IO and set_tris_c
Using the set_tris_c() command, I can decide which pin is input and output. But what happen with a I2C communication?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 04, 2008 12:37 pm     Reply with quote

The compiler inserts code to set the SDA and SCL pins to be inputs,
as required by the PIC data sheet. Don't change the TRIS on the
SDA and SCL pins.
angel



Joined: 19 Oct 2004
Posts: 40

View user's profile Send private message

so...
PostPosted: Thu Mar 06, 2008 8:52 am     Reply with quote

so using RC2 and RC3 for a software I2C communication, the code:

#use fast_io(C)
#define I2C_SDA PIN_C2
#define I2C_SCL PIN_C3
#use I2C (master, sda=I2C_SDA , scl=I2C_SCL)
...............................
...............................
set_tris_c(0b00001100);


is it correct?
Thanks
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