PDA

View Full Version : DS1307 Functionality



DynamoBen
- 27th October 2005, 16:02
I have my DS1307 wired up and working well. I used the MN1307 example as a kind of template.

I'm looking to trim back the code and make it less extensive. The MN1307 code does all of the hand holding to ensure values don't go out of range.

I would like to just increment a value, send it to the RTC, then read the RTC and display the result.

The question is if the value is out of range, for example value 25 is sent for the hour, will the RTC just loop back around to 1? (basically I want the RTC to do the hand holding)

mytekcontrols
- 27th October 2005, 16:55
I'm using this RTC in my project as well.

Yes it does need you to do the error checking as far as setting the clock is concerned. I did a test where I entered the value of 60 into the Seconds register. it kept on counting 61,62,63... until it got to 80, where it rolled over and left 40 behind. After this it continued to work correctly, and rolled over properly at 59, only leaving zero behind as it should.

So to reiterate; an error routine is required to limit the values that someone can enter when setting the clock (and calendar as well), but other than this the DS1307 will take care of itself from a time and date keeping sense.

DynamoBen
- 27th October 2005, 17:04
Fair enough I will just leave that code in there.

As far as date is the same issue going to occur? Example: User enters 31st for the date but the month they selected has 30 days.

Thanks for checking this out....my code isn't fair enough for me to test.

Melanie
- 28th October 2005, 00:53
The DS1307 allows the entry of silly values which is why you need to prevent it happening.

DynamoBen
- 28th October 2005, 01:15
Oh well, can't fault a guy from trying. Thanks for the help.