
III PERIPHERAL MODULES 1 (SYSTEM): REAL-TIME CLOCK (RTC)
S1C33E07 TECHNICAL MANUAL
EPSON
III-3-7
III
RTC
III.3.3.3 Selecting 12/24-hour Mode and Setting the Counters
Selecting 12-hour/24-hour mode
Whether to use the time clock in 12-hour or 24-hour mode can be selected using RTC24H (D4/0x301908).
RTC24H = 1: 24-hour mode
RTC24H = 0: 12-hour mode
The count range of hour counters changes with this selection.
RTC24H: 24H/12H Mode Select Bit in the RTC Control Register (D4/0x301908)
Basically, this setting should be changed while the counters are idle. RTC24H (D4/0x301908) is allocated to
the same address as the control bits that start the counters. Therefore, 12-hour mode or 24-hour mode can be
selected at the same time the counters are started.
Note: Rewriting RTC24H (D4/0x301908) may corrupt count data for the hours, days, months, years or
days of the week. Therefore, once RTC24H (D4/0x301908) settings are changed, be sure to set
data back in these counters again.
Checking A.M./P.M. with 12-hour mode selected
When 12-hour mode is selected, RTCAP (D6/0x301918) that indicates A.M. or P.M. is enabled.
RTCAP = 0: A.M.
RTCAP = 1: P.M.
For 24-hour mode, RTCAP (D6/0x301918) is fixed to 0.
RTCAP: AM/PM Indicator Bit in the RTC Hour Register (D6/0x301918)
When setting the time of day, write either of the values above to this bit to specify A.M. or P.M.
Setting the counters
Idle counters can be accessed for read or write at any time.
However, settings like those shown below should be avoided, since such settings may cause timekeeping errors.
Settings exceeding the effective range
Do not set count data exceeding 60 seconds, 60 minutes, 12 or 24 hours, 31 days, 12 months, or 99 years.
Settings nonexistent in the calendar
Do not set such nonexistent dates as April 31 or February 29, 2006. Even if such settings are made, the
counters operate normally, so that when 1 is carried over from the hour counter to the 1-day counter, the day
counter counts up to the first day of the next month. (For April 31, the day counter counts up to May 1; for
February 29, 2006, the day counter counts up to March 1, 2006.)
If any counter must be rewritten while operating, there is a procedure that must be followed to ensure that
the counter is rewritten correctly. For details, see Section III.3.3.6, “Reading from and Writing to Counters in
Operation.”
III.3.3.4 Starting, Stopping, and Resetting Counters
Starting and stopping counters
The RTC starts counting when RTCSTP (D1/0x301908) is set to 0, and stops counting when this bit is set to 1.
RTCSTP: Counter Run/Stop Control Bit in the RTC Control Register (D1/0x301908)
The RTC is stopped by writing 1 to RTCSTP (D1/0x301908) at the 32-kHz input clock divide-by stage of 8,192
Hz or those stages that follow. The RTC does not stop at up to the input clock divide-by-2 stage (16,384 Hz).
If the RTC stops counting when 1 is carried over to the next-digit counter, the count value may be corrupted.
Therefore, see the next section to ensure that 1 is not carried over when counters are made to stop. This is
unnecessary, however, when the contents of all counters are newly set again.
Resetting the counters
RTCRST (D0/0x301908) is the bit used to reset the 32 kHz to 2 Hz counters.
RTCRST: Software Reset Bit in the RTC Control Register (D0/0x301908)
Setting RTCRST (D0/0x301908) to 1 resets the counters above (cleared to 0), and writing 0 to this bit negates
the reset.