floresta:
... but for your being so kind as to clarify your remark.
The only reason he had to clarify his remark is because he is the one who introduced the red herring. In my opinion he is the one who did not fully understand "the thread of the question" we were discussing. It was obvious, before he started talking about Start and Stop encapsulation etc., that we were discussing the internal workings of the clock chip itself and not the I2C implementation.
He quotes "the data sheet" but I have no idea what data sheet he is referring to. I can't find the phrases he quotes in my Maxim DS1307 data sheet. In my data sheet I found one place where the term 'I2C START' is used in conjunction with reference to the buffers, but that was referring to reading, not writing.
Now, for the benefit of future Googlers, let me summarize the first two entries in this thread.
The original post questioned why, when using the sketch provided by ladyada, one cannot set a clock that is already running.
The second post gave the answer. It has nothing to do with the clock chip, it is because that particular sketch was written to perform in that manner.
Don
Personally, 'Don' I that you need to read the thread, before spouting off and 'warning' others about posts.
DANE:
Has anyone else experienced that the DS1307 won't set if it already has the time? I'm using the ladyada library which includes a sketch to set the time using system time from the point of compiling (which means the time is out by about 15s). I've found that the time won't adjust if I've already set it and I have to remove the battery to set the time again! Seems very odd…
The fact that it will set if I remove the battery seems to rule out any sketch or connections issues?
retrolefty:
The DS1307 must be stopped to set new time and data values, and then restarted. Most (all?) DS1307 libraries will have those commands avalible for use. No need to pull the battery. Note this fragment section from my RTC sketch for setting the time and data, note it first issues a RTC.stop() command, then sets the data values and ends with a RTC.start() command. Note that if a DS1307 (if it has a functioning back-up battery) is powered off while it was running, it will automatically return to the running mode when powered back up.
RTC.stop(); // chip must be stopped before sending new values
RTC.set(DS1307_SEC,0); //set the seconds
RTC.set(DS1307_MIN,28); //set the minutes
RTC.set(DS1307_HR,23); //set the hours note 24 hour clock
RTC.set(DS1307_DOW,5); //set the day of the week
RTC.set(DS1307_DATE,13); //set the date
RTC.set(DS1307_MTH,1); //set the month
RTC.set(DS1307_YR,11); //set the year
RTC.start(); // chip must be started for RTC to run
Lefty
The first post clearly includes the sentence
"Has anyone else experienced that the DS1307 won't set if it already has the time?" then goes on to state the library being use is lady ada's
The second post clearly states the need to call RTC.stop() this post is not a 'red-herring', it is in the forum for all to see, nor does it mention anything about Lady ada, in fact if you knew anything about the lady ada library you would know that there in not even an RTS.stop() function, which would indicate we are obviously NOT talking about the lady ada library and the thread has moved on, albeit without your permission, but moved on it has.
Finally take a look at the title of the post.
"DS1307 won't set if already set", nope I don't see anything about a reference specifically to the lady ada library(granted the initial poster may have overlooked it, but by default the thread is now open to discuss ALL aspects of "DS1307 won't set if already set").
In my following post, hopefully the issue will be settled once and for all, irrelevant of the library used.