DS1302 question
Lee Harker
Posts: 104
Hi Stampers,
I'm working on a project that I'm hoping someone could advise me.
I am reading 4 different times in order somewhat like a relay race. I'm using the DS1302 RTC and it's mostly working. I want to set it to 0 to measure each of my 4 times and then read out the minutes and seconds. For convenience I made a subroutine that would just reset all the registers to 0 and found that they only get reset to 0 the first time after power-up. Then I read a single line in the DS1302 app note that the "date" should only be set once per power-up.
I have found no mention of this in any other document including the Dallas data sheet.
If this is true, does that mean If I try to do it, the registers will just ignore the command?
Thanks.
Lee Harker
I'm working on a project that I'm hoping someone could advise me.
I am reading 4 different times in order somewhat like a relay race. I'm using the DS1302 RTC and it's mostly working. I want to set it to 0 to measure each of my 4 times and then read out the minutes and seconds. For convenience I made a subroutine that would just reset all the registers to 0 and found that they only get reset to 0 the first time after power-up. Then I read a single line in the DS1302 app note that the "date" should only be set once per power-up.
I have found no mention of this in any other document including the Dallas data sheet.
If this is true, does that mean If I try to do it, the registers will just ignore the command?
Thanks.
Lee Harker
Comments
It seems as though the DS1302 will not allow the time to be set again unless it has been read first. Can anyone confirm if this is true or am just not doing something else right. If this is the case, I can put in a dummy read in the cases that I want to set the time and it has not been read yet but there's no reason if it's not necessary
Lee Harker
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
·· Just curious why you're trying to reset the date if you're using the time, and resetting it anway?· You could optionally have the DS1302 set to the "real" time then convert that "on the fly" to all seconds.· For each event you store the time (In seconds), and then you can compare after.· Don't know if this would work in your application or not.· Also in the Projects forum there are 2 or 3 projects using the DS1302.· Some of the code may be of interest to you.· And I don't recall any problems setting the date repeatedly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Short
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Chris, it's a good question why I'm reseting everything. The only answer is that's where I started and I hadn't optimized my software. I just told the stamp to reset the whole enchilada then I wouldn't have to do the math for midnight operation and so forth. I just thought it would be easier to take 4 seperate times and add them at the end than to go through all the math every read. I usually have pretty good control of the beast but this one had me stumped.
Lee Harker