Renesas R5S72623 Doll User Manual


  Open as PDF
of 2152
 
Section 14 Realtime Clock
R01UH0134EJ0400 Rev. 4.00 Page 703 of 2108
Sep 24, 2014
SH7262 Group, SH7264 Group
14.4.4 Alarm Function
Figure 14.4 shows how to use the alarm function.
Write 0 to AIE in RCR1
to prevent errorneous interrupt
Use a periodic interrupt set up in RCR2 to wait for 1/64 of a second
in the cases shown below.
When recovery from deep standby mode is initiated by an alarm interrupt.
When the ENB bit in an alarm register is set at another time after setting
of the alarm time.
Clock running
Set alarm time
Use a periodic interrupt
to wait for 1/64 of a second.
Disable alarm interrupt
Always reset, since the flag may have been
set while the alarm time was being set.
Write 1 to AIE in RCR1
Clear alarm flag
Enable alarm interrupt
Monitor alarm time
(wait for interrupt or
check alarm flag)
Figure 14.4 Using Alarm Function
Alarms can be generated using seconds, minutes, hours, day of the week, date, month, year, or any
combination of these. Set the ENB bit in the register on which the alarm is placed to 1, and then
set the alarm time in the lower bits. Clear the ENB bit in the register on which the alarm is not
placed to 0.
When the clock and alarm times match, 1 is set in the AF bit in RCR1. Alarm detection can be
checked by reading this bit, but normally it is done by interrupt. If 1 is set in the AIE bit in RCR1,
an interrupt is generated when an alarm occurs.
The alarm flag is set when the clock and alarm times match. However, the alarm flag can be
cleared by writing 0.