R01UH0823EJ0100 Rev.1.00
Page 797 of 1823
Jul 31, 2019
RX23W Group
28. Realtime Clock (RTCe)
28.3.7
Procedure for Disabling Alarm Interrupt
shows the procedure for disabling the enabled alarm interrupt request.
Figure 28.8
Procedure for Disabling Alarm Interrupt Request
28.3.8
Time Error Adjustment Function
The time error adjustment function is used to correct errors (running fast or slow) in the time due to the precision of
oscillation by the sub-clock. Since 32,768 cycles of the sub-clock constitute 1 second of operation when the sub-clock is
selected, the clock runs fast if the sub-clock frequency is high and slow if the sub-clock frequency is low. This function
can be used to correct errors due to the clock running fast or slow.
Two types of time error adjustment functions are provided: automatic adjustment and adjustment by software.
Use the RCR2.AADJE bit to select automatic adjustment or adjustment by software.
28.3.8.1
Automatic Adjustment
Enable automatic adjustment by setting the RCR2.AADJE bit to 1.
Automatic adjustment is the addition or subtraction of the value counted by the prescaler to or from the value in the
RADJ register every time the adjustment period selected by the RCR2.AADJE bit elapses.
Examples are shown below.
[Example 1] Sub-clock running at 32.769 kHz
Adjustment procedure:
When the sub-clock is running at 32.769 kHz, 1 second elapses every 32,769 clock cycles. The RTC is meant to run at
32,768 clock cycles, so the clock runs fast by one clock cycle every second. The time on the clock is fast by 60 clock
cycles per minute, so adjustment can take the form of setting the clock back by 60 cycles every minute.
Register settings: (when RCR2.CNTMD = 0)
RCR2.AADJP = 0 (adjustment every minute)
RADJ.PMADJ[1:0] = 10b (adjustment is performed by the subtraction from the prescaler.)
RADJ.ADJ[5:0] = 60 (3Ch)
AIE bit = 0?
Start while the RCR1.AIE bit is 1
No
Yes
Wait for the RCR1.AIE bit to become 0
Clear the interrupt status flag
Set the ICU.IRn.IR flag corresponding to the ALM
interrupt to 0 in case the flag becomes 1 before
the RCR1.AIE bit becomes 0
Disable an alarm interrupt request on ICU side
Disable an alarm interrupt request of RTC side
Write 0 to the RCR1.AIE bit
Write 0 to the ICU.IERm.IENj bit corresponding to
the ALM interrupt
An alarm interrupt is enabled