View previous topic :: View next topic |
Author |
Message |
Kit Guest
|
I2C on 16F628A (non-I2C PIC) |
Posted: Tue Jul 12, 2005 7:54 pm |
|
|
Hi,
I have some questions regarding the implementation of I2C in 16F628A.
I used to implement I2C eeprom with PIC16F877A by using #use i2c picc function. PIC16F877A has two dedicated pins (SDL and SCL) for I2C.
However for this time, I am using PIC16F628A, which doesn't have the dedicated pins for I2C. When I use Project Wizard in PICC, the I2C option has been greyed out.
1. Is there anyway to use I2C with P16F628A, in PICC?
2. If we still can implement I2C with P16F628A, why does CCS PICC grey it out? What is the purpose of dedicated pins, if we still can implement I2C with or without them?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jul 12, 2005 8:33 pm |
|
|
The dedicated SDA and SCL pins can be used for hardware i2c. CCS has
library code to support hardware i2c. This is invoked with the
FORCE_HW parameter in the #use i2c() statement.
If you want to do i2c on other pins, CCS has a library for software i2c.
However, the software i2c can only be used for Master mode, not Slave. |
|
|
Kit Guest
|
|
Posted: Tue Jul 12, 2005 10:58 pm |
|
|
If everything can be done in software, why does the PIC Wizard grey out the I2C options? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jul 13, 2005 12:03 am |
|
|
I don't have PCW, so somebody else will have to tell you about
using software i2c with the Wizard. |
|
|
Ttelmah Guest
|
|
Posted: Wed Jul 13, 2005 3:18 am |
|
|
Kit wrote: | If everything can be done in software, why does the PIC Wizard grey out the I2C options? |
The wizard only provides controls for the hardware features. The same applies to RS232, where you can only setup hardware ports with the wizard.
The options are greyed out when hardware does not exist to spcifically support the option. All you have to do, is setup the required #use I2c line yourself.
Realistically, I consider the wizard, the source of more problems than it solves!. However what they should perhaps do, is add an entry to the 'drivers' selectable, for 'software I2C'.
Best Wishes |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Wed Jul 13, 2005 8:34 am |
|
|
You also have the option of just bit-banging it.
Ronald
Smile.... you're one day closer to retirement. |
|
|
|