View previous topic :: View next topic |
Author |
Message |
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
i2c on pic16f886 by using other pins than c4 and c3 |
Posted: Tue Sep 02, 2008 4:08 pm |
|
|
Hi.
Is it possible to use a i2c protocol in a pic if i am using c4 and c3 with a spi interface to cc1000 board?
I basically need to generate a software i2c from other pins, but i don't want to open a black hole for myself before i start the project.
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 02, 2008 4:24 pm |
|
|
Are you asking if you can create software i2c master on other pins ?
The answer is yes. It's fully supported by the #use i2c() statement.
(You can only do an i2c slave on the hardware pins). |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Tue Sep 02, 2008 5:05 pm |
|
|
Can i just use this type of function with the normal i2c functions and just change the pins or what has to be different else?
Code: | #use i2c(Master, sda=PIN_C4, scl=PIN_C3, FORCE_HW) |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 02, 2008 5:08 pm |
|
|
Get rid of the FORCE_HW, if you use other pins. The compiler will
ignore it anyway. |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Tue Sep 02, 2008 5:20 pm |
|
|
Thanks.
I will then try that and hopefully not struggle to much. |
|
|
|