Datasheet

±5ppm, I
2
C Real-Time Clock
12 Maxim Integrated
DS3231M
time information is read from these secondary registers,
while the clock can continue to run. This eliminates the
need to reread the registers in case the main registers
update during a read.
Clock and Calendar
The time and calendar information is obtained by read-
ing the appropriate register bytes. Table 2 shows the
RTC registers. The time and calendar data are set or
initialized by writing the appropriate register bytes. The
contents of the time and calendar registers are in the
binary-coded decimal (BCD) format. The device can
be run in either 12-hour or 24-hour mode. Bit 6 of the
Hours register is defined as the 12-hour or 24-hour mode
select bit. When high, the 12-hour mode is selected. In
the 12-hour mode, bit 5 is the AM/PM bit with logic-high
being PM. In the 24-hour mode, bit 5 is the 20-hour bit
(20–23 hours). The century bit (bit 7 of the Month regis-
ter) is toggled when the Years register overflows from 99
to 00. The day-of-week register increments at midnight.
Values that correspond to the day of week are user-
defined but must be sequential (i.e., if 1 equals Sunday,
then 2 equals Monday, and so on). Illogical time and
date entries result in undefined operation. When reading
or writing the time and date registers, secondary buffers
are used to prevent errors when the internal registers
update. When reading the time and date registers, the
secondary buffers are synchronized to the internal reg-
isters on any I
2
C START and when the register pointer
rolls over to zero. The time information is read from these
secondary registers, while the clock continues to run.
This eliminates the need to reread the registers in case
the main registers update during a read. The countdown
chain is reset whenever the seconds register is writ-
ten. Write transfers occur on the acknowledge from the
device. Once the countdown chain is reset, to avoid roll-
over issues the remaining time and date registers must
be written within 1s.
Alarms
The device contains two time-of-day/date alarms. Alarm
1 can be set by writing to registers 07h–0Ah. Alarm
2 can be set by writing to registers 0Bh–0Dh. See
Table 2. The alarms can be programmed (by the alarm
enable and INTCN bits in the Control register) to acti-
vate the INT/SQW output on an alarm match condition.
Bit 7 of each of the time-of-day/date alarm registers are
mask bits (Table 2). When all the mask bits for each
alarm are logic 0, an alarm only occurs when the values
in the timekeeping registers match the corresponding
values stored in the time-of-day/date alarm registers.
The alarms can also be programmed to repeat every
second, minute, hour, day, or date. Table 3 shows the
possible settings. Configurations not listed in the table
result in illogical operation. The DY/DT bits (bit 6 of the
alarm day/date registers) control whether the alarm
value stored in bits 0–5 of that register reflects the day
of the week or the date of the month. If DY/DT is written
to logic 0, the alarm is the result of a match with date of
the month. If DY/DT is written to logic 1, the alarm is the
result of a match with day of the week.
Table 3. Alarm Mask Bits
DY/DT
ALARM 1 REGISTER MASK BITS (BIT 7)
ALARM RATE
A1M4 A1M3 A1M2 A1M1
X 1 1 1 1 Alarm once a second
X 1 1 1 0 Alarm when seconds match
X 1 1 0 0 Alarm when minutes and seconds match
X 1 0 0 0 Alarm when hours, minutes, and seconds match
0 0 0 0 0 Alarm when date, hours, minutes, and seconds match
1 0 0 0 0 Alarm when day, hours, minutes, and seconds match
DY/DT
ALARM 2 REGISTER MASK BITS (BIT 7)
ALARM RATE
A2M4 A2M3 A2M2
X 1 1 1 Alarm once per minute (00 seconds of every minute)
X 1 1 0 Alarm when minutes match
X 1 0 0 Alarm when hours and minutes match
0 0 0 0 Alarm when date, hours, and minutes match
1 0 0 0 Alarm when day, hours, and minutes match