i2c and DS1337

Hi:

I spent the weekend trying to get I2C working between my Arduino 011

and a Dallas DS1337 RTC chip.

In searching for examples, I came across a few, but none that would work for the RTC.

Is there any detailed information anywhere that explains what is handled by Wire.h ?

I found the Wiring site, but no information on how it integrates with Arduino. Trying to use the IDE from Wiring returned an error from my Arduino saying that it couldn't connect properly with Wiring

I also found the CRAL libraries which appear to have exactly what I am looking for, but again; no documentation on how to set things up. I added includes to cover each of the code files that needed to be available, but that just left me needing an example that shows what the RTC needs.

I downloaded the C test/prototype code from the Dallas site and spent last night converting it to Arduino code. I had no problem getting the SDA and SCL signals going with digitalWrite (HIGH / LOW) as need abd /I could get the code to compile. It functions by setting paramaters from a menu using scanf to read the input. I tried pre-populathing the choices that I would have selected, but without being able to use scanf or something similar I am now stuck.

Is there any way to read the PC keyboard input through the Arduino code?

I have managed to get I2C working in a PICAXE environment in the past, but it was done through using code to toggle all the SDA an SCL signals and SHIFTing the data in and out.

From what I read, all of the interfacing is done in Wire.h, so I really need to know what is being handled there so that I don't work against myself.

All comments / observations welcome

thanks

TimVukman

are you using the analog ports for the spi/i2c ?
I spent a few days getting the 1307 to work, until I found out that its the analog ports thats used, not the digital ones.

Hi Mora:

Thanks, yes I am using the analog ports. I'm struggling more with general questions on the interfacing.

I2C uses a 7 bit address and then I presume Wire.h pads that address to indicate read or write. When defining the address, do you start with the high nibble justified left, or do you leave a 0 in Bit7 and use everything to the right of it?

thanks

TimVukman

Just use the 7 bits of the slave address.
So in your case - (1101000) Wire.beginTransmission(0x68); should be correct.

Thanks BroHogan

I plan on trying again tonight

Ok, it is later tonight. I used this web site's listing and through careful modification of the code I am able to talk to the DS1337

F:\Downloads\arduino-0011-win\i2c\lets get physical! November 2006 Archives.mht

In his blog, he did indicate when he was writing the device address and when he was writing the register he wanted to write or read, so I am off and running.

I will get my code set for putting a predetermined time in place during the setup() and read the time in the loop(). This is just the beginning as I will interface this to a keypad to set time and alarms and then either use an led or lcd panel. I'm leaning toward an LED panel as it will be an alarm clock.

Thanks all for the help.

If there is any interest in the code I will post it once I have it cleaned up.

Thanks

Tim