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

using pin RD2 and RD3 I2C of 18F4431 in slave mode

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



Joined: 22 May 2013
Posts: 18

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

using pin RD2 and RD3 I2C of 18F4431 in slave mode
PostPosted: Sun Dec 29, 2013 12:28 pm     Reply with quote

I use the SDA and SCL pins of the SSP module of PIC18F4431 multiplexed with the RD2 and RD3 pins to use it for I2C bus. But the i2c could not work.
I find in the forum and so show that it is the bug of the compiler.
Could you have the solution to help me to fix this?
I'm using the version 4.114
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sun Dec 29, 2013 1:19 pm     Reply with quote

If you use the right syntax, it does work. The problem is that the compiler doesn't 'know' that pins D2&D3 are the I2C.
Way round it is to program the I2C, with:

#use i2c(SLAVE,I2C1,Address=xx)

This tells the compiler to use the hardware I2C1 device, which it happily then does.
Add the fuse:

SSP_RD

which then connects the I2C1 device to D2/D3.

Make sure the TRIS on D2, and D3 is set to 1 (by default it is unless you change it). Output_float(PIN_D2); and output_float(PIN_D3);

Best Wishes
jemmyduc



Joined: 22 May 2013
Posts: 18

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

PostPosted: Sun Dec 29, 2013 9:17 pm     Reply with quote

I had a good I2C performance. Thank for your help.
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 1:18 am     Reply with quote

Good.

It is one of those "pity they didn't document how to do it" things.

Have a good New Year.
jemmyduc



Joined: 22 May 2013
Posts: 18

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

PostPosted: Mon Dec 30, 2013 10:21 pm     Reply with quote

Thank you again.
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