Alarm Function - Hitachi SH7709S Hardware Manual

Superh risc engine
Table of Contents

Advertisement

13.3.4

Alarm Function

Figure 13.4 shows how to use the alarm function.
Alarms can be generated using seconds, minutes, hours, day of the week, date, month, or any
combination of these. Set the ENB bit (bit 7) to 1 in the register to which the alarm applies, and
then set the alarm time in the lower bits. Clear the ENB bit to 0 in registers to which the alarm
does not apply.
When the clock and alarm times match, 1 is set in the AF bit (bit 0) in RCR1. Alarm detection can
be checked by reading this bit, but normally it is done by interrupt. If 1 is placed in the AIE bit (bit
3) in RCR1, an interrupt is generated when an alarm occurs.
Clock running
Set whether to use
alarm interrupt
Set alarm time
Clear alarm flag
Monitor alarm time
(wait for interrupt or
check alarm flag)
428
Disable interrupts for preventing error
interrupts (clear the AIE bit in RCR1 to 0).
Then write 1 to the AIE bit in RCR1.
Always reset, since the flag may have
been set while the alarm time was being
set (clear the AF bit in RCR1 to 0).
Figure 13.4 Using the Alarm Function

Advertisement

Table of Contents
loading

Table of Contents