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, PIC16F877 and the SDA, SCL

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







I2C, PIC16F877 and the SDA, SCL
PostPosted: Wed Apr 09, 2003 11:13 pm     Reply with quote

Hello,

I have a question about I2C on PIC16F877.

My program is as simple as follows:

#use I2C(master, sda=PIN_C4, scl=PIN_C3, fast)

i2c_start();
i2c_write(address); //7 bit address + 0
i2c_write(0xEE);
i2c_stop();

The thing I am wondering about is why the clock is not normal, even when a device is not attached. I try to measure with an oscilloscope and the clock is shovn as a fast capacitor charging
not as pulse train.

I have remembered to make pull-up resistors and have two devices connected to the bus a DS1624 (temperature sensor) and DS1339(RTC), but as I said even without the devices clock and data are behaving odd.

Can somebody tell me what is wrong?

Thanks In Advance
Kenan Vilic
___________________________
This message was ported from CCS's old forum
Original Post ID: 13567
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

Re: I2C, PIC16F877 and the SDA, SCL
PostPosted: Wed Apr 09, 2003 11:49 pm     Reply with quote

:=Hello,
:=
:=I have a question about I2C on PIC16F877.
:=
:=My program is as simple as follows:
:=
:=#use I2C(master, sda=PIN_C4, scl=PIN_C3, fast)
:=
:=i2c_start();
:=i2c_write(address); //7 bit address + 0
:=i2c_write(0xEE);
:=i2c_stop();
:=
:=The thing I am wondering about is why the clock is not normal, even when a device is not attached. I try to measure with an oscilloscope and the clock is shovn as a fast capacitor charging
:=not as pulse train.
:=
:=I have remembered to make pull-up resistors and have two devices connected to the bus a DS1624 (temperature sensor) and DS1339(RTC), but as I said even without the devices clock and data are behaving odd.
:=
:=Can somebody tell me what is wrong?
:=
:=Thanks In Advance
:=Kenan Vilic

Try adding:
setup_spi(FALSE);
also leave out "fast" in
#use I2C(master, sda=PIN_C4, scl=PIN_C3, fast)
for testing until you have found the problem.
Pullups should be around 2k2 (see i2c specs).
Let's know how you go.

Regards
Kenny
___________________________
This message was ported from CCS's old forum
Original Post ID: 13568
Kenan Vilic
Guest







Re: I2C, PIC16F877 and the SDA, SCL
PostPosted: Thu Apr 10, 2003 10:14 am     Reply with quote

Hi,

:=Try adding:
:=setup_spi(FALSE);
Did not help

:=also leave out "fast" in
:=#use I2C(master, sda=PIN_C4, scl=PIN_C3, fast)
:=for testing until you have found the problem.
Tried that, no difference

:=Pullups should be around 2k2 (see i2c specs).
Hurray!!! that was the problem... I had to use 56k pull-ups for a hall switch so I used the same for the I2C lines...Changing them was the solution.

Thank you very much Kenny
Kenan
___________________________
This message was ported from CCS's old forum
Original Post ID: 13584
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