View previous topic :: View next topic |
Author |
Message |
horde_fuego
Joined: 31 Mar 2009 Posts: 11
|
i2c in PIC16F84A |
Posted: Fri May 15, 2009 4:14 am |
|
|
Is this possible with PIC16F84A alone? I need more i/o pins but unfortunately we don't have any PIC16F877A or any other PICs. Will the command from CCS C like i2c_start() or i2c_read work even if it doesn't have any dedicated SCL and SDA in it?
Any suggestions or clarifications or tips will be highly appreciated. Thanks in advance!! ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Fri May 15, 2009 8:31 am |
|
|
Yes.
CCS, implements a software I2C master, if you just use any pins on the chip, that don't have hardware I2C abilities.
All the standard library functions work quite well.
Half of the library examples, for I2C, default to chips without the hardware present.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Fri May 15, 2009 9:35 am |
|
|
You need to understand that software I2C works in Master mode. If you're wanting to have a PIC run as a Slave you had better select one that has the hardware built in.
You can assign SCL & SDA to almost any pin you want to use. There are a few exceptions, like a pin that's Input only or something that's dedicated to a certain function. Otherwise, the compiler takes care of everything for you. Just put the correct pin assignments in your #use i2c() statement and you're ready to fly.
Ronald |
|
![](templates/subSilver/images/spacer.gif) |
horde_fuego
Joined: 31 Mar 2009 Posts: 11
|
|
Posted: Sat May 16, 2009 5:03 am |
|
|
thank you very much!!!i'll try it now! ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|