
iiiPeriPheraLModuLes1(systeM):reaL-tiMeCLoCk(rtC)
iii-3-8
ePson
s1C33L17teChniCaLManuaL
iii.3.3.5CounterholdandBusyFlag
If 1 is carried over when reading the counters, the correct counter value may not be read out. Moreover, if a write or
stop operation is attempted, the counter value may be corrupted. Therefore, whether counters are in a carry (busy)
state should be checked before reading or writing data from or to the count registers. For this purpose, control bits
RTCBSY (D1/0x30190C) and RTCHLD (D0/0x30190C) are provided.
rtCBsy:CounterBusyFlagintheRTCAccessControlRegister(D1/0x30190C)
rtChLd:CounterHoldControlBitintheRTCAccessControlRegister(D0/0x30190C)
RTCBSY (D1/0x30190C) is a read-only flag indicating that 1 is being carried over. RTCBSY (D1/0x30190C) is
set to 1 when 1 is being carried over; otherwise, it is 0. RTCBSY (D1/0x30190C) should be confirmed as being 0
before accessing the counters to ensure that the correct value will be read or set.
Note, however, that RTCBSY (D1/0x30190C) is fixed to 1 while counting is in progress. To reflect the current state
in the count value, RTCHLD (D0/0x30190C) should be set to 1.
rtCBsy=0(rtCaccessible)
If the value of RTCBSY (D1/0x30190C) is 0 when this bit is read out after writing 1 to RTCHLD (D0/0x30190C),
it means that 1 is not being carried over. In this case, the counter hold function is actuated, with a carry over of
1 to the 1-second counter disabled in hardware. Counters that count less than seconds continue operating.
Data can be read from or written to the count registers in this state.
After reading or writing data, reset RTCHLD (D0/0x30190C) to 0.
When 1 must be carried over while data is being read or written with counters in the hold state, 1 second is
automatically added at the time, with RTCHLD (D0/0x30190C) reset to 0 to correct the count value. This
correction is effective for only 1 second, and the time to carry over 1 on subsequent occasions is ignored. In this
case, timekeeping data gets out of order. Therefore, be sure to reset RTCHLD (D0/0x30190C) to 0 as soon as
possible after completing the necessary read or write operation.
rtCBsy=1(rtCisbusy)
If the value of RTCBSY (D1/0x30190C) is 1 when this bit is read after writing 1 to RTCHLD (D0/0x30190C),
it means that 1 is being carried over. The period needed for the counters to carry over 1 is 4 ms per second. In
this case, reset RTCHLD (D0/0x30190C) to 0 as soon as possible and [A] recheck RTCBSY (D1/0x30190C)
by following the same procedure or [B] wait 4 ms before checking RTCBSY (D1/0x30190C).
If RTCBSY (D1/0x30190C) is found to be 1, be sure to immediately reset RTCHLD (D0/0x30190C) to 0. If
RTCHLD (D0/0x30190C) is left at 1, the time of day may become incorrect.
RTCHLD
←1
RTCBSYread
Registerread/write
RTCHLD
←0
RTCBSY=0?
RTCHLD
←0
No
a
B
Yes
RTCHLD
←1
RTCBSYread
Registerread/write
RTCHLD
←0
RTCBSY=0?
RTCHLD
←0
No
Yes
4mswait
FigureIII.3.3.5.1ProcedureforCheckingwhethertheRTCisBusy
There is also a method of reading out data without using RTCHLD (D0/0x30190C) and RTCBSY (D1/0x30190C).
(See the next section.)