English
Language : 

HD6417727BP160CV Datasheet, PDF (534/1098 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperH™ RISC engine Family/ SH7700 Series
Section 16 Realtime Clock (RTC)
16.3.4 Alarm Function
Figure 16.4 shows how to use the alarm function.
Alarm can be generated using seconds, minutes, hours, day of the week, date, month, or any
combination of these. Set the ENB bits (bit 7) in the desired alarm registers to 1, and then set the
alarm time in the lower bits. Clear the ENB bits in the registers which are not used for the alarm to
0.
When the clock and alarm time match, the AF bit (bit 0) in RCR1 is set to 1. The alarm detection
can be checked by reading this bit, but normally it is checked by the interrupt generation. If the
AIE bit (bit 3) in RCR1 is written with 1, an interrupt is generated when an alarm occurs.
Clock running
Cancel alarm
interrupt
Set alarm time
Disables interrupts (clears the AIE bit in
RCR1 to 0) in order to prevent erroneous
interrupts, and then writes 1.
Clear alarm flag
Always reset the alarm flag, since a flag may
have been set while the alarm time was being
set (clear the AF bit in RCR1 register to 0).
Monitor alarm time
(wait for interrupt or
check alarm flag)
Figure 16.4 Using the Alarm Function
Rev.6.00 Mar. 27, 2009 Page 476 of 1036
REJ09B0254-0600