User Manual

Apollo3 Blue Datasheet
DS-A3-0p9p1 Page 548 of 909 2019 Ambiq Micro, Inc.
All rights reserved.
12.3.4 Alarms
There are seven Alarm Registers which may be used to generate an Alarm interrupt at a specific time.
These registers correspond to the 100
th
of a second (REG_CLK_GEN_ALMLOW_ALM100), second
(REG_CLK_GEN_ALMLOW_ALMSEC), minute (REG_CLK_GEN_ALMLOW_ALMMIN), hour
(REG_CLK_GEN_ALMLOW_ALMHR), day of the month (REG_CLK_GEN_ALMUP_ALMDATE), day of
the week (REG_CLK_GEN_ALMUP_ALMWKDY) and month (REG_CLK_GEN_ALMUP_ALMMO)
Calendar Counters. The comparison is controlled by the REG_CLK_GEN_RTCCTL_RPT field and the
REG_CLK_GEN_ALMLOW_ALM100 Register as shown in 12/24 Hour Mode. In the ALM100 Register, n
indicates any digit 0-9. When all selected Counters match their corresponding Alarm Register, the ALM
interrupt flag is set (see the Clock Generator section for the ALM interrupt control).
All alarm interrupts are asserted on the next 100 Hz clock cycle after the counters match the alarm register,
except for 100ths of a second. To get an interrupt that occurs precisely at a certain time, the comparison
value in the corresponding alarm register should be set 10 ms (one 100 Hz count) earlier than the desired
interrupt time.
For the 100ths of a second interrupt, the first 100 Hz clock sets the comparison with the alarm register and
the next clock asserts the interrupt. Therefore, the first 100ths interrupt will be asserted after 20 ms, not
10 ms. This occurs each and every time the 100ths of a second counter with interrupts is enabled if the
RTC is stopped. If the RTC is already running when configured, then the first interrupt will occur between
10 and 20 ms after configuration.
12.3.5 12/24 Hour Mode
If the REG_CLK_GEN_RTCCTL_HR1224 bit is 0, the RTC is in 24-hour mode, and the Hours and Hours
Alarm Registers hold a 6-bit BCD value which is the 24-hour time (values 0 to 23). If the HR1224 bit is 1,
the RTC is in 12-hour mode, and the Hours and Hours Alarm Registers hold a 5-bit BCD value which is the
12-hour time (values 1 to 12) , and bit 5 is the AP bit which is 0 for an AM time and 1 for a PM time. If the
HR1224 bit is modified the Hours and Hours Alarm fields must be updated.
12.3.6 Century Control and Leap Year Management
The REG_CLK_GEN_CTRUP_CB bit indicates the current century. A value of 0 indicates the 20
th
century,
and a value of 1 indicates the 19
th
or 21
st
century. The CB value will toggle when the Years counter rolls
over from 99 to 0 if the REG_CLK_GEN_CTRUP_CEB bit is set, and will remain constant if CEB is clear.
The century value is used to control the Leap Year functions, which create the correct insertion of February
29 in years which are divisible by 4 and not divisible by 100, and also the year 2000.
Table 796: Alarm RPT Function
RPT Value Interval Comparison
000 Disabled None
001 Every year
100
th
, second, minute, hour, day, month
010 Every month
100
th
, second, minute, hour, day
011 Every week
100
th
, second, minute, hour, weekday
100 Every day
100
th
, second, minute, hour
101 Every hour
100
th
, second, minute
110 Every minute
100
th
, second
111 Every second
100
th