9 REAL-TIME CLOCK (RTC)
S1C17651 TECHNICAL MANUAL
Seiko Epson Corporation
9-3
RTC Control
9.3
Operating Clock Control
9.3.1
The RTC module uses the 256 Hz clock output by the CLG module as the operation clock (normally, RTC is
clocked by the F256 clock (regulated 256 Hz clock) derived from the OSC1A divider). Therefore, the OSC1 oscil-
lator must be turned on before starting the RTC. However, the clock is not supplied to the RTC module while RTC is
stopped even if the OSC1 oscillator is on. For detailed information on clock control, see the “Clock Generator (CLG)”
and “Theoretical Regulation (TR)” chapters.
Notes: The RTC module input clock frequency is 256 Hz only when the OSC1 clock frequency is
32.768 kHz. The frequency described in this chapter will vary accordingly for other OSC1
clock frequencies.
The RTC module can also be operated with the OSC1B divider clock (about 256 Hz) even if
OSC1B is selected as the OSC1 clock source in the CLG. However, the RTC cannot be used
as an accurate clock.
The OSC1A divider is reset when the RTC starts running (when 1 is written to RTCRUN/RTC_
CTL register). This affects the count operations of the timer modules (CT, WDT, and T16A2),
as new 256 Hz cycle begins from that point.
After an initial reset, RTCRUN is set to 0 and the RTC idles. The OSC1 oscillator circuit is also
idle. Therefore, resetting the IC suspends the RTC operation for the period shown below.
RTC idle time = [#REST = low period] +
[OSC3B oscillation stabilization time] +
[Time until OSC1 is started] +
[OSC1 oscillation stabilization time] +
[Time until RTC is restarted]
12-hour/24-hour mode selection
9.3.2
Whether to use the clock in 12-hour or 24-hour mode can be selected using RTC24H/RTC_CTL register.
RTC24H = 1: 12-hour mode
RTC24H = 0: 24-hour mode
The count range of the hour counter changes with this selection.
Basically, this setting should be changed while the counters are idle. RTC24H 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.
Checking A.M./P.M. with 12-hour mode selected
When 12-hour mode is selected, AMPM/RTC_H register that indicates A.M. or P.M. is enabled.
AMPM = 0: A.M.
AMPM = 1: P.M.
For 24-hour mode, AMPM is fixed to 0.
When setting the time of day, write either of the values above to this bit to specify A.M. or P.M.
RTC Start/Stop
9.3.3
The RTC starts counting when RTCRUN/RTC_CTL register is set to 1, and stops counting when this bit is set to 0.
The OSC1A divider in the CLG module is reset by writing 1 to RTCRUN and it starts division of the OSC1A clock.
Counter Settings
9.3.4
Counter values should be set in the procedure shown below.
1. Stop the RTC by writing 0 to RTCRUN/RTC_CTL register.
2. Wait until RTCST/RTC_CTL register is reset to 0 (the RTC actually stops operating).