Question about the RTC

20 Apr 2010

When one sets the time on the RTC I assume the most granular control available is the second?

When I set the RTC I have a need to zero the seconds so they are truly zero and not 300mS into the second or whatever.

Ideally I think I need a MILLISEC register as well as SECONDS, HOURS, MINS etc etc! Either that or I need to be able to resync the 1Hz timing pulse into the RTC so it restarts when I want it to.

Or have I got this totally wrong ?

I'm not even sure I have explained this too well but hopefully you'll get what I mean??!!

Regards

Lynton

 

20 Apr 2010

Hi Lynton,

Lynton Towler wrote:
When one sets the time on the RTC I assume the most granular control available is the second?
Yes, that is exactly right. When you set the time using set_time(), it configures the SEC, MIN, HOUR, ... registers of the RTC hardware.

Lynton Towler wrote:
When I set the RTC I have a need to zero the seconds so they are truly zero and not 300mS into the second or whatever. Ideally I think I need a MILLISEC register as well as SECONDS, HOURS, MINS etc etc! Either that or I need to be able to resync the 1Hz timing pulse into the RTC so it restarts when I want it to. Or have I got this totally wrong ? I'm not even sure I have explained this too well but hopefully you'll get what I mean??!!
I think I do get what you mean! There are no sub-second registers exposed to software, so you cant set at sub-second granularity; the RTC receives a 1Hz clock.

However, it does look like there is a way to reset the internal elements of the RTC divider, which would effectively have the same result as setting the sub-second elements to zero. It looks like we could therefore include this as part of the setting procedure, so both setting the time and ensuring the divider is cleared.

We could perhaps enhance the library to that behaviour assuming that is what you are after?

Simon

20 Apr 2010
Simon Ford wrote:

We could perhaps enhance the library to that behaviour assuming that is what you are after?

Simon,

That sounds like it might do the trick but if I'm the only one who needs that functionality then please don't go and make yourself a heck of a lot of work just for me because I can live with it as is.

The extra functionality would be a "nice to have" at some point.

Lynton

06 Jul 2010

Hi all,

I could do with an mSecs register too. I need to read the rtc at a certain point in the program and add an offset, in mSecs. Every subsequent program cycle would then check the time and compare it with the original value plus offset. Kind of a dynamic timeout.

Now someone is gonna tell me a better way to do it ;)

 

Best Regards,

James