11.3.1.2 Calendar Mode
The RTCC includes a calendar mode which implements time and date decoding in hardware. Calendar mode is enabled by configuring
CNTMODE in RTCC_CTRL to CALENDAR. When in calendar mode, the counter value is available in RTCC_TIME and RTCC_DATE.
RTCC_TIME shows seconds, minutes, and hours while RTCC_DATE shows day of month, month, year, and day of week. RTCC_TIME
and RTCC_DATE are encoded in BCD format. In calendar mode, the pre-counter should be configured to give ticks with a period of one
second, i.e. RTCC_CTRL_CNTTICK should be set to PRESC, and the CNTPRESC bitfield of the RTCC_CTRL register should be set
to DIV32768 if a 32768 Hz clock source is used.
In calendar mode, the time and date registers of the capture compare channels, RTCC_CCx_TIME and RTCC_CCx_DATE, are used to
set compare values. Compare values can be set on seconds, minutes, hours, days, and months. Whether day of week, or day of month
is used for a Capture/Compare channel is configured in RTCC_CCx_CTRL_DAYCC in the respective Capture/Compare channel.
The RTCC will automatically compensate for 28-, 29- (leap year), 30-, and 31-day months. The day of week counter,
RTCC_DATE_DAYOW, is a three bit counter incrementing when RTCC_TIME_HOURT overflows, wrapping around every seventh day.
Automatic leap year correction, extending the month of February from 28 to 29 days every fourth year is by default enabled, but can be
disabled by setting the LYEARCORRDIS bit in RTCC_CTRL. The pseudocode for leap year correction is as follows:
if RTCC_DATE_YEART modulo 2 = 0:
if RTCC_DATE_YEARU modulo 4 = 0:
leap_year = true
else:
leap_year = false
else:
if (RTCC_DATE 2) modulo 4 = 0:
leap_year = true
else:
leap_year = false
The seconds, minute, hour segments are represented in 24-hour BCD format. The month segments are enumerated as shown in
11.2 RTCC calendar enumeration on page 294
.
Table 11.2. RTCC calendar enumeration
Month
RTCC_DATE_MONTHT
RTCC_DATE_MONTHU
January
0b0
0b0001
February
0b0
0b0010
March
0b0
0b0011
April
0b0
0b0100
May
0b0
0b0101
June
0b0
0b0110
July
0b0
0b0111
August
0b0
0b1000
September
0b0
0b1001
October
0b1
0b0000
November
0b1
0b0001
December
0b1
0b0010
11.3.1.3 RTCC Initialization
The counters of the RTCC, RTCC_CNT (RTCC_TIME and RTCC_DATE in calendar mode) and RTCC_PRECNT, can at any time be
written by software, as long as the registers are not locked using RTCC_LOCKKEY. All RTCC registers use the immediate synchroniza-
tion scheme, described in
.
Note:
Writing to the RTCC_PRECNT register may alter the frequency of the ticks for the RTCC_CNT register.
EFM32JG1 Reference Manual
RTCC - Real Time Counter and Calendar
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 294