cancel
Showing results for 
Search instead for 
Did you mean: 

REAL TIME CLOCK (RTC) read problem

Posted on June 03, 2009 at 20:51

REAL TIME CLOCK (RTC) read problem

2 REPLIES 2
Posted on May 17, 2011 at 13:13

Has anyone seen an issue (and found a solution) for millisecond read greater than 999 bcd.

See attached for details.

[ This message was edited by: jonathan.peterson on 03-06-2009 16:07 ]

swhite
Associate III
Posted on May 17, 2011 at 13:13

The RTC registers are not in BCD they're binary.

I use this code to create millisecond resolution timestamps.

secs = RTC_GetCounter();

ms = 1000 * ((RTC_XTAL_FREQUENCY - 1) - RTC_GetDivider()) / RTC_XTAL_FREQUENCY;

I use the Standard Peripheral Library v3.0.0 functions instead of direct register accesses.