Wondering if there is a definitive guide to getting these RTC's working.
I have had a good read through the forums and these have highlighted a few things I have tried, but to no avail.
I have also looked at the playground articles, but again to no avail
Perhaps somebody can help ...please, it's reaaly doing me head in
I have one of the Duemilanove boards
the IC is the maxim DS1307+
I am using a 3v lithium battery as a backup. I have connected the Vbat connector to the +ve connector of the batter, and the -ve to ground. I have the ground on the IC connected to ground on the arduino.
I have the 5v line from the arduino connected to the vcc pin on the IC
i'm connecting pin 4 analog from the arduino to SDA on the IC and ping 5 analog to SCL on the IC.
I am using 1 k ohm resistor as a pull up between the SDA and 5V lines and another one on the SCL pin.
My problem is that I can set the time, it just doesn't tick and advance the time
Is there a routine to check the integrity of the DS1307? I noted on the library for the DS1337 there seems to be a check integrity command is there anything similar for this one?
oh, I also tried taking the battery out of the picture and just grounding the Vbat pin. That didnt get me anywhere either
any help would be most appreciated
Did you clear the "Clock Halt" bit? Page 8 of the DS1307 data sheet says:
Note that the initial power-on state of all registers is not defined. Therefore, it is important to enable the oscillator (CH bit = 0) during initial configuration.
So if you don't set the clock halt bit to 0 the oscillator doesn't tick which leads to the behaviour you are experiencing.
So this is the code #include <WProgram.h> #include <Wire.h> #include <DS1307.h> // written by mattt on the Arduino forum and modified by D. Sjunnesson
void setup()
{
Serial.begin(9600);
RTC.stop();
RTC.set(DS1307_SEC,1); //set the seconds
RTC.set(DS1307_MIN,23); //set the minutes
RTC.set(DS1307_HR,12); //set the hours
RTC.set(DS1307_DOW,4); //set the day of the week
RTC.set(DS1307_DATE,5); //set the date
RTC.set(DS1307_MTH,3); //set the month
RTC.set(DS1307_YR,9); //set the year
RTC.start(); // thought this called the start method
It works, well kinda
I changed over my DS1307 for my DS1337. Wired it up as it suggests in the Maxim product info page and tried the same code again
It ticks this time.
although oddly it does seem to like to revisit the same moment in time more than once
although oddly it does seem to like to revisit the same moment in time more than once
Well time does tend to march on.
What is exactly your expectations here? How often the time is read from the RTC and sent out to the serial monitor is a function of the cycle time of your program, the I2C link speed and the baud rate of the communication channel rather then the RTC module. If you wish each time capture to be unique then you will have to test each recieved and throw away duplicates. Or put a delay of one second in your loop somewhere.