8 Real-TiMe ClOCK (RTC)
8-6
Seiko epson Corporation
S1C17624/604/622/602/621 TeChniCal Manual
Counter hold and Busy Flag
8.3.5
If 1 is carried over when writing the counters, the counter value may be corrupted. Therefore, whether counters are
in a carry (busy) state should be checked before writing data to the count registers. For this purpose, control bits
RTCBSY/RTC_CNTL1 register and RTCHLD/RTC_CNTL1 register are provided.
RTCBSY is a read-only flag indicating that carry is taking place. RTCBSY is set to 1 when carry is taking place;
otherwise, it is 0. RTCBSY should be confirmed as being 0 before accessing the counters to ensure that the correct
value will be set.
Writing 1 to RTCHLD suspends the counter operations. Note, however, that writing 1 to RTCHLD is ignored if
RTCBSY is set to 1.
RTCBSY = 0 (RTC accessible)
When a value of 0 is read from RTCBSY after writing 1 to RTCHLD, it means that carry is not taking place. In
this state, counter data can be written to.
After 1 is written to RTCHLD, the counters stop operating. So RTCBSY is fixed at 0, as carry will not take
place. In this case, the counter hold function is also actuated, with a carry over of 1 to the 1-second counter dis-
abled in hardware. The divider (counter for less than one second) continues operating.
Write data to the counter registers.
After writing data, reset RTCHLD to 0.
If 1 is being carried over when data is being written to a counter in the hold state, 1 second is automatically
added to correct the counter values when RTCHLD is reset to 0. This correction is only effective for 1 second
and no correction is conducted on the carry encountered in the second time and on. In this case, the timekeep-
ing data gets out of order. Therefore, be sure to reset RTCHLD to 0 as soon as possible after completing the
required write operation.
RTCBSY = 1 (RTC is busy)
When a value of 1 is read from RTCBSY after writing 1 to RTCHLD, it means that carry is taking place.
In this case, writing 1 to RTCHLD is ignored and RTCHLD retains 0.
A period of 4 ms per second is required for a carry over of 1 to the counters. In this case, [A] repeat writing 1 to
RTCHLD and checking RTCBSY or [B] write 1 to RTCHLD and check RTCBSY after waiting for 4 ms.
RTCHLD
←
1
RTCBSY read
Register write
RTCHLD
←
0
RTCBSY = 0?
No
a
B
Yes
RTCHLD
←
1
RTCBSY read
Register write
RTCHLD
←
0
RTCBSY = 0?
No
Yes
4 ms wait
3.5.1 Procedure for Checking whether the RTC is Busy
Figure 8.
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.