CMS32L051 User Manual |Chapter 7 Real-Time Clock
www.mcu.com.cn 241 / 703
7.4.4 Alarm setting for real-time clock
You must first set the WALE to 0 (the alarm is not working) and then set the alarm time.
Figure 7-21 Alarm setting steps
Start
WALE=0
Configure SECWALIE=1
Configure ALARMWM
Configure ALARMWH
Configure ALARMWW
WALE=1
WAFG=1?
Yes
No
alarm processing
alarm alignment operation invalid
generate interrupt via alarm
alignment
configure alarm minute register
configure alarm hour register
configure alarm week register
alarm alignment operation valid
INTRTC=1?
No
Yes
detect alarm
alignment
No
fixed cycle interrupt
processing
Note 1 There is no restriction on the order in which alarm clock minutes registers (ALARMWMs), alarm hour registers
(ALARMWH), and alarm clock day registers (ALARMWWs) are written.
2. Fixed-cycle interrupts and alarm clock consistent interrupts use the same interrupt source (INTRTC). When using
both interrupts at the same time, you can determine which interrupt occurred by acknowledging the fixed-cycle
interrupt status flag (RIFG) and the alarm detection status flag (WAFG) when INTRTC occurs.