8 REAL-TIME CLOCK (RTC)
S1C33L26 TECHNICAL MANUAL
Seiko Epson Corporation
8-7
30-second Correction
8.3.6
The description “30-second correction” means resetting the seconds to 0 and adding 1 to the minutes when seconds
of the time clock are in the range of 30 to 59 seconds. When in the range of 0 to 29 seconds, the RTC resets the sec-
onds to 0 but it does not change the minutes. This function may be used to round up seconds to minutes when reset-
ting seconds in an application.
This function can be executed by writing 1 to RTCADJ/RTC_CNTL0 register.
Writing 1 to RTCADJ causes the RTC to operate as follows:
• When the 10-second counter is 3 or more, the RTC generates a carry over of 1 to start counting by the 1-minute
counter.
• When the 10-second counter is 2 or less, the RTC does not generate a carry over of 1.
After RTCADJ is set to 1, it remains set for the 4-ms period required for this processing, then automatically returns
to 0. To check whether the 30-second correction processing has completed or not, [A] repeat checking RTCADJ or
[B] check RTCADJ after waiting for 4 ms.
Accessing the counters while RTCADJ = 1 is prohibited. Writing 0 to RTCADJ and writing 1 to RTCRST are also
prohibited, because it would cause the RTC to operate erratically.
Writing 1 to RTCADJ when RTCBSY is 1 may corrupt the counter values. Always make sure that RTCBSY is set
to 0 before writing 1 to RTCADJ.
RTCADJ
←
1
RTCADJ read
RTCADJ = 0?
No
Yes
RTCADJ
←
1
RTCADJ read
RTCADJ = 0?
No
Yes
4 ms wait
RTCHLD
←
1
RTCBSY read
RTCHLD
←
0
RTCBSY = 0?
No
A
B
Yes
RTCHLD
←
1
RTCBSY read
RTCHLD
←
0
RTCBSY = 0?
No
Yes
4 ms wait
3.6.1 Procedure for Executing 30-second Correction
Figure 8.
Counter Read
8.3.7
In order to prevent carry over during reading counters, the RTC includes a read buffer to hold counter data.
Before reading counter data, set RTCRDHLD/RTC_CNTL1 register to 1 to load the current counter data to the read
buffer.
While RTCRDHLD is set to 1, the buffered data is read out from the counter registers. Be sure to reset RTCRD-
HLD to 0 after the buffered data is read out. This operation does not affect the counters. The counters keeps count-
ing while RTCRDHLD is set to 1.