Home/Support/Support Forum/Real Time Clock does not seem to update?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Real Time Clock does not seem to update?

0 votes
Working with a 6700 series interface board and initially updated the rtc from a web server. Reading it after the initial update gives me the correct time. Although, when I run some simple code again to check the time, all the same values remain.

Here is a subroutine from my code:
Code:
void getTime() { unsigned int curHour = rtc.tm_hour; unsigned int curMin = rtc.tm_min; printf("Hour: %d\n", curHour); printf("Min: %d\n", curMin); }

If I had just updated rtc using server at the moment (1:17), I would get:
Code:
Hour: 01 Min: 17

What am I forgetting to do here?
asked Dec 4, 2014 in Rabbit Software by killswitchSevenfold New to the Community (2 points)

Please log in or register to answer this question.

2 Answers

0 votes
you should run the following 2 samples found in Samples\RTCLOCK
setrtckb.c


Example of setting the real-time clock from keyboard entry.

This program sets the Rabbit real-time clock from keyboard entry:
valid dates are from 1/1/1980 (entered as 1/1/80) to
12/31/2047 (entered as 12/31/47). Just press Enter
to leave the real-time clock unchanged.

and

rtc_test.c


Example of using the real-time clock functions by checking year 2000 rollover.

This program demonstrates the use of the RTC functions by:
1. reading (and saving) the current date/time settings
2. setting the date to 12/31/99 at 23:59:00
3. reading the RTC again two seconds later
4. setting the RTC back to the original date/time
answered Dec 4, 2014 by MargaretK Veteran of the Digi Community (545 points)
0 votes
What are you using to set the RTC?

You should use tm_wr() to write to the RTC. To read from the RTC you should use read_rtc(), not tm_rd().

tm_rd() reads from the macro SEC_TIMER which will not be updated until the power is reset.
answered Dec 4, 2014 by trooper2 Veteran of the Digi Community (589 points)
...