PDA

View Full Version : i2c clock speed on 16F887



robertpoll
- 28th April 2010, 16:58
Hi,

I'm running a 16F887 with an I2C connection to a DS1307. It's all working fine, but the clock is running at about 50kHz. I'm using the internal 8MHz oscillator on the 16F887, and (I think) have the right DEFINEs...

; Set Clock to 8KHz
OSCCON = %01110001
DEFINE OSC 8 ; tell PBP about clock speed

Am using PBP 2.47. Any ideas what the problem might be? Being able to do the transfer twice as quickly would help me out.

thanks in advance,

...rob

tenaja
- 28th April 2010, 17:48
Are you using the s/w bit bang command, or the hardware bus commands? That's about as fast as the s/w commands can go.
Have you tried reducing the values of your pullup resistors? Dropping down to 5k or less can sometimes reduce the transition times, and it is especially helpful if they are "on the fence" as far as timing goes.

robertpoll
- 29th April 2010, 09:52
Thanks very much for the response. I'm using I2CREAD - I'd assumed that since I was using the right pins on the PIC it was using the hardware feature, but it looks like that's not the case. I guess there's no way to use the hardware from picbasic and you have to do it in assembler...?

I guess the other alternative is to crank the clock speed up..?

I'm using 4k7 pullups by the way.

thanks again,

...rob


Are you using the s/w bit bang command, or the hardware bus commands? That's about as fast as the s/w commands can go.
Have you tried reducing the values of your pullup resistors? Dropping down to 5k or less can sometimes reduce the transition times, and it is especially helpful if they are "on the fence" as far as timing goes.