|
|
View previous topic :: View next topic |
Author |
Message |
Kenan Vilic Guest
|
I2C, PIC16F877 and the SDA, SCL |
Posted: Wed Apr 09, 2003 11:13 pm |
|
|
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
|
Re: I2C, PIC16F877 and the SDA, SCL |
Posted: Wed Apr 09, 2003 11:49 pm |
|
|
:=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 |
Posted: Thu Apr 10, 2003 10:14 am |
|
|
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 |
|
|
|
|
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
|