
iiiPeriPheraLModuLes1(systeM):reaL-tiMeCLoCk(rtC)
s1C33L17teChniCaLManuaL
ePson
iii-3-7
III
RTC
iii.3.3.3selecting12/24-hourModeandsettingtheCounters
selecting12-hour/24-hourmode
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/12HModeSelectBitintheRTCControlRegister(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: RewritingRTC24H(D4/0x301908)maycorruptcountdataforthehours,days,months,yearsor
daysoftheweek.Therefore,onceRTC24H(D4/0x301908)settingsarechanged,besuretoset
databackinthesecountersagain.
Checkinga.M./P.M.with12-hourmodeselected
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/PMIndicatorBitintheRTCHourRegister(D6/0x301918)
When setting the time of day, write either of the values above to this bit to specify A.M. or P.M.
settingthecounters
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.4starting,stopping,andresettingCounters
startingandstoppingcounters
The RTC starts counting when RTCSTP (D1/0x301908) is set to 0, and stops counting when this bit is set to 1.
rtCstP:CounterRun/StopControlBitintheRTCControlRegister(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.
resettingthecounters
RTCRST (D0/0x301908) is the bit used to reset the 32 kHz to 2 Hz counters.
rtCrst:SoftwareResetBitintheRTCControlRegister(D0/0x301908)
Setting RTCRST (D0/0x301908) to 1 resets the counters above (cleared to 0), and writing 0 to this bit negates
the reset.