Pages: [1]   Go Down
Author Topic: I2C via other available Pins  (Read 3525 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi,

I understand that the current "Wire" library sets Port C4 and Port C5 for I2C. Is there a way to set other ports as I2C comms? Thanks in advance!
Logged

Dallas, TX
Offline Offline
Full Member
***
Karma: 0
Posts: 170
Check out my blog on your smartphone!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I dont think you can do that.
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 225
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are libraries that bit-bang I2C communication on other pins.  For example, the JeeLabs "Ports" library:  http://cafe.jeelabs.net/sw/library_-_ports/
Logged

Orygun
Offline Offline
Full Member
***
Karma: 0
Posts: 195
Don't let the smoke out!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I2C is hardwired into the AtMega168 and 328 to use those pins. See the pin mapping diagram http://arduino.cc/en/Hacking/PinMapping168 for the functions available from these chips to show how they map to the Arduino pin layout. Port C4 = AD4/SDA and Port C5 = AD5/SCL.

Jee Labs has done work on an Arduino variant and uses software I2C to extend the number of I2C capable pins here http://news.jeelabs.org/2010/03/15/software-and-hardware-i2c/ and I think this http://cafe.jeelabs.net/sw/library_-_ports/ is the library that allows the JeeNode to do this. Instructions are given for adding it to the Arduino IDE.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi  Professor Chaos and capt.tagon,

Thanks alot! It's exactly what I'm looking for, bit-bang I2C.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wait.. so can you redirect I2C to other digital pins and then use Analog_4 and Analog_5 as regular analog pins to measure voltages? Or would Analog_4 and Analog_5 still be hogtied by I2C?
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 627
Posts: 34243
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you bit banged the I2C and didn't use the internal I2C hardware then yes you could reclaim those two analogue inputs.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just find "SoftI2CMaster.h" and its associated c - it works well.

Code:
#include <SoftI2cMaster.h>
#define SCL_PIN 9
#define SDA_PIN 8
SoftI2cMaster rtc;
#define DS1307ADDR 0XD0
« Last Edit: July 01, 2010, 06:25:07 am by CharlesDavis » Logged

Pages: [1]   Go Up
Jump to: