Architecture
1322
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Real-Time Clock (RTC)
27.2.4 Operation
27.2.4.1 Using the Real-Time Clock Time and Calendar Registers
The current time and date are maintained in the RTC time and calendar registers.
27.2.4.1.1 Time/Calendar Data Format
The time and calendar data in the RTC is stored as binary-coded decimal (BCD) format. In BCD format,
the decimal numbers 0 through 9 are encoded with their binary equivalent. Although most of the
time/calendar registers have 4 bits assigned to each BCD digit, some of the register fields are shorter
since the range of valid numbers may be limited. For example, only 3 bits are required to represent the
day since only BCD numbers 1 though 7 are required.
The following time and calendar registers are supported (BCD Format):
•
SECOND - Second Count (00-59)
•
MINUTE - Minute Count (00-59)
•
HOUR - Hour Count (12HR: 01-12; 24HR: 00-23)
•
DAY - Day of the Month Count (01-31)
•
MONTH - Month Count (01-12; JAN = 1)
•
YEAR - Year Count (00-99)
•
DOTW - Day of the Week Count (0-6; SUN = 0)
Note that the ALARM registers which share the names above also share the same BCD formatting.
27.2.4.1.2 12-Hour and 24-Hour Modes
The current time can be represented in 12-hour or 24-hour mode by configuring the HOURMODE bit in
the control register (CTRL):
•
When HOURMODE = 0, 24-hour mode is selected. The hours are represented as 00 through 23. The
MERIDIEM bit in the HOURS register has no function and should be cleared.
•
When HOURMODE = 1, 12-hour mode is selected. The hours are represented as 00 through 12.
MERIDIEM = 0 indicates ante meridiem (AM), and MERIDIEM = 1 indicates post meridiem (PM).
27.2.4.1.3 Reading from Time/Calendar Registers
The time/calendar registers are updated every second as the time changes. During a read of the
SECOND register, the RTC copies the current values of the time/date registers into shadow read
registers. This isolation assures that the CPU can capture all the time/date values at the moment of the
SECOND read request and not be subject to changing register values from time updates.
If desired, the RTC also provides a one-time-triggered minute-rounding feature to round the
MINUTE:SECOND registers to the nearest minute (with zero seconds). This feature is enabled by setting
the ROUNDMIN bit in the control register (CTRL); the RTC automatically rounds the time values to the
nearest minute upon the next read of the SECOND register.
27.2.4.1.4 Writing to Time/Calendar Registers
When setting the RTC time and date, values are written directly to the time/calendar registers. Therefore,
care must be taken to avoid writing to the time/calendar registers while the time is updating to the next
second. This can be accomplished in one of two ways:
1. The RTC can be stopped by clearing the RUN bit in the control register (CTRL). When stopped, there
is no danger of contention during writes because the registers do not auto-update.
2. The BUSY bit in the status register (STATUS) is low when a time update does not take place for at
least 15
μ
s. By checking for a low BUSY bit before writing to registers, the CPU is assured of a 15
μ
s
window of time during which multiple accesses to the time/calendar registers can be performed.