Datasheet

MCP7940N
DS20005010F-page 20 2010-2014 Microchip Technology Inc.
5.4 Alarms
The MCP7940N features two independent alarms.
Each alarm can be used to either generate an interrupt
at a specific time in the future, or to generate a periodic
interrupt every minute, hour, day, day of week, or
month.
There is a separate interrupt flag, ALMxIF, for each
alarm. The interrupt flags are set by hardware when the
chosen alarm mask condition matches (Table 5-5). The
interrupt flags must be cleared in software.
If either alarm module is enabled by setting the corre-
sponding ALMxEN bit in the CONTROL register, and if
the square wave clock output is disabled (SQWEN =
0), then the MFP will operate in Alarm Interrupt Output
mode. Refer to Section 5.5 “Output Configurations”
for details. The alarm interrupt output is available while
operating from the backup power supply.
Both Alarm0 and Alarm1 offer identical operation. All
time and date values are stored in the registers as
binary-coded decimal (BCD) values.
TABLE 5-5: ALARM MASKS
FIGURE 5-6: ALARM BLOCK DIAGRAM
Note: Throughout this section, references to the
register and bit names for the alarm mod-
ules are referred to generically by the use
of ‘x’ in place of the specific module num-
ber. Thus, “ALMxSEC” might refer to the
seconds register for Alarm0 or Alarm1.
ALMxMSK<2:0> Alarm Asserts on Match of
000 Seconds
001 Minutes
010 Hours
011 Day of Week
100 Date
101 Reserved
110 Reserved
111 Seconds, Minutes, Hours, Day of
Week, Date, and Month
Note 1: The alarm interrupt flags must be cleared
by the user. If a flag is cleared while the
corresponding alarm condition still
matches, the flag will be set again, gener-
ating another interrupt.
2: Loading invalid values into the alarm reg-
isters will result in undefined operation.
MFP
RTCSEC
RTCMIN
RTCHOUR
RTCWKDAY
RTCDATE
RTCMTH
Timekeeping
Registers
ALM1SEC
ALM1MIN
ALM1HOUR
ALM1WKDAY
ALM1DATE
ALM1MTH
Alarm1
Registers
ALM0SEC
ALM0MIN
ALM0HOUR
ALM0WKDAY
ALM0DATE
ALM0MTH
Alarm0
Registers
Alarm0 Mask Alarm1 MaskComparator Comparator
MFP Output Logic
Set
ALM0IF
Set
ALM1IF
ALM0MSK<2:0>
ALM1MSK<2:0>