View previous topic :: View next topic |
Author |
Message |
The Rookie Guest
|
I2C Read with 12F629 |
Posted: Mon Jun 07, 2004 10:11 am |
|
|
Is it possible to read I2C with 12F629 which does not have a I2C engine and does not support I2C_READ() library.
How complex is it to write this routine so that 12F629 can read. |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Mon Jun 07, 2004 11:20 am |
|
|
The I2C functions do not require a hardware module that supports I2C. They can be use on a software port. I2C functions are not dificult to write. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Mon Jun 07, 2004 11:35 am |
|
|
If all you want is a Master I2C controller then you can use the built in I2C functions. Software I2C in a Slave is a bit more difficult. |
|
|
falleaf
Joined: 23 May 2004 Posts: 48
|
|
Posted: Mon Jun 07, 2004 12:22 pm |
|
|
Have you got some examples of I2C communication on C? I'm trying with CCS C! << Usually use MPASM, but learning to use C. |
|
|
The rookie Guest
|
The built in I2C funtions |
Posted: Mon Jun 07, 2004 4:39 pm |
|
|
According to the manual. The master I2C write, start and stop do not require and I2C engine in the micro. But the polling and read is not supported by 12F series micros do not support the builtin I2C read() |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 07, 2004 4:47 pm |
|
|
You need to state whether you want the 12F629 to be an i2c Master
or an i2c Slave. |
|
|
falleaf
Joined: 23 May 2004 Posts: 48
|
|
Posted: Mon Jun 07, 2004 8:41 pm |
|
|
Oh sorry, I would like to reference for a standard I2C routine in C only. I'm working with 16F876a. I need both master and slave code examples.
May you send me them?
Well, the fact that the slave examples in CCS C is only so simple and it's random read buffer, so I cannot imagine the way to write.
I wrote I2C under ASM, and there are some bits needed to notice. I don't know if writing in C need or no need to check these bits?
For example,
I write PWM in C. To change PWM duty cycles, I need to wait until timer2 is overflow, but I don't know C code will do it or not? Because it only has the set_pwm_duty function only.
I don't know if I have to check timer2 overflow or not?? It's the similar question as I write I2C in C. I'm newbie in C for PIC. Thanks muchie. |
|
|
|