PDA

View Full Version : I2C function... clock pin?



Qacer
- 2nd February 2006, 18:58
Hi all,

Does PICBasic Pro generate the I2C clock signal with the I2CRead and I2Cwrite function? Or do I need to connect the clock in of the I2C device with the clock out of the PIC12F675?

My main curiousity is that I want to know if I can just assign any clock pin using the I2C functions.

Thanks!

Dave
- 2nd February 2006, 21:34
Qacer, The Pic micro produces the clock for the read and write operation. You can use any pin available on the Pic micro for the clock pin. Just make sure you use a pullup resistor on this pin as well as the data pin. Approx. 4.7K Ohms.

Dave Purola,
N8NTA

Qacer
- 2nd February 2006, 21:45
Thanks again, Dave!

In regards to pull-up resistors, I was reading Microchip's Getting Started: I2C Master Mode. They have a slide that shows suggested Pull-up values. They have 4.7k (less than 4.7 kbps), 2.2k (100 kbps), and 1k (400 kbps). What data rate have you achieved using 4.7k?

I'm just curious to see if Microchip's values seem pretty reasonable.

Thanks!

Dave
- 2nd February 2006, 21:54
Qacer, The resistor values you have mentioned are correct. The equipment I design is battery powered and I have not had any problem communicating with 24lc515 eeprom's @ 400 Khz with 4.7K resistors for the pullup. I however would not use anything bigger than that. Also I use the I2C bus on the PCB only but with smaller resistors you could use this bus for somewhat longer runs. If you can afford the current draw, it is best to use approx. 2.2K Ohms.

Dave Purola,
N8NTA

Qacer
- 2nd February 2006, 22:09
Thanks again, Dave!