English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (482/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
PIC32MX3XX/4XX
21.3 Alarm Mode
The PIC32MX RTCC module provides alarm functions
with the following features:
• One-time alarm
• Repeat alarms
• Indefinite alarm repetition
• Configurable from half-second to one year
The RTCC alarm generates an alarm event when the
RTCC timer matches the masked alarm value.
The RTCC alarm functions are configurable from a
half-second to one year and can repeat the alarm at
preconfigured intervals. The chime feature provides
indefinite repetition of the alarm.
To enable the alarm feature, configure the ALRMEN bit
(RTCALRM<15>) = 1. To disable the alarm feature,
configure the ALRMEN bit = 0. An alarm event is
generated when the RTCC timer matches the masked
alarm registers.
Note 1: Once the timer value reaches the alarm
setting, one RTCC clock period will
elapse prior to setting the alarm interrupt.
2: IF RTCC is off (RTCCON<15> = 0) the
writable fields in the RTCALRM register
can be safely modified. If RTCC is ON,
the write of the RTCALRM register has to
be done while ALRMSYNC = 0. Not fol-
lowing the above steps can result in a
false alarm event.
3: The same applies to the ALRMTIME and
ALRMDATE registers: They can be safely
modified only when ALRMSYNC = 0.
21.3.1 ALARM CONFIGURATION
The ALRMTIME and ALRMDATE registers can be pro-
grammed with the desired time and date numeric val-
ues expressed in Binary Coded Decimal (BCD) format.
This simplifies users’ firmware as each of the digit
values is contained within its own 4-bit value (see
Figure 21-3).
FIGURE 21-3:
ALARM DIGIT FORMAT
MONTH
DAY
DAY OF WEEK
0-1
0-9
0-3
0-9
0-6
HOURS
(24-hr format)
0-2
0-9
MINUTES
0-5
0-9
SECONDS
0-5
0-9
The alarm interval selection is based on the settings of
the alarm mask, AMASK (RTCALRM<11:8>). The
AMASK bits determine which and how many digits of
the alarm must match the RTCC clock value for the
alarm event to occur (see Figure 21-4).
FIGURE 21-4:
ALARM MASK SETTINGS
Alarm Mask Setting Day of the
AMASK<3:0>
Week Month
Day
Hours Minutes Seconds
0000 – Every half-second
0001 – Every second
0010 – Every 10 seconds
s
0011 – Every minute
ss
0100 – Every 10 minutes
m ss
0101 – Every hour
mm s s
0110 – Every day
h h mm s s
0111 – Every week
d
h h mm s s
1000 – Every month
dd
hh
mm
ss
1001 – Every year(1)
mm
dd
hh
mm
ss
Note 1: Annually, except when configured for February 29.
21.3.2 ONE-TIME ALARM
A single, one-time alarm can be generated by configur-
ing the Alarm Repeat Counter bits, ARPT
(RTCALRM<7:0>) = 0, and the CHIME bit,
(RTCALRM<14>) = 0. Once the alarm event occurs,
the ALRMEN bit is automatically cleared in hardware,
disabling future alarms. The user must re-enable this
bit for any new alarm configuration.
It is suggested to read and verify the Alarm Sync bit,
ALRMSYNC (RTCALRM<12>) = 0, before performing
the following configuration:
• Disable Alarm – ALRMEN (RTCALRM<15>) = 0.
• Disable Chime – CHIME (RTCALRM<14>) = 0.
• Clear Alarm Repeat Counter – ARPT
(RTCALRM<7:0>) = 0.
The remaining bits are shown with example configura-
tions and may be configured as desired:
• Configure alarm date and time – Load
ALRMDATE and ALRMTIME registers with the
desired alarm date/time values.
• Configure mask – Load the desired AMASK
value.
• Enable Alarm – ALRMEN (RTCALRM<15>) = 0.
Refer to Example 21-4
DS61143E-page 480
Preliminary
© 2008 Microchip Technology Inc.