Epson S1C17624 Technical Manual page 80

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

8 Real-TiMe ClOCK (RTC)
8.3.5
Counter hold and Busy Flag
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.
a
RTCHLD ← 1
RTCBSY read
RTCBSY = 0?
Yes
Register write
RTCHLD ← 0
8.3.6
30-second Correction
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.
8-6
No
Figure 8.
3.5.1 Procedure for Checking whether the RTC is Busy
Seiko epson Corporation
B
RTCHLD ← 1
RTCBSY read
RTCBSY = 0?
Yes
Register write
RTCHLD ← 0
S1C17624/604/622/602/621 TeChniCal Manual
4 ms wait
No

Advertisement

Table of Contents
loading

This manual is also suitable for:

S1c17604S1c17622S1c17602S1c17621

Table of Contents