13.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, it is configured in RTCC_CCx_CTRL_DAYCC of 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 pseudo-code 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_YEARU + 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
13.2 RTCC calendar enumeration on page
Month
January
February
March
April
May
June
July
August
September
October
November
December
silabs.com | Building a more connected world.
380.
Table 13.2. RTCC calendar enumeration
RTCC_DATE_MONTHT
0b0
0b0
0b0
0b0
0b0
0b0
0b0
0b0
0b0
0b1
0b1
0b1
RTCC - Real Time Counter and Calendar
RTCC_DATE_MONTHU
0b0001
0b0010
0b0011
0b0100
0b0101
0b0110
0b0111
0b1000
0b1001
0b0000
0b0001
0b0010
Reference Manual
Table
Rev. 1.1 | 380
Need help?
Do you have a question about the EFR32xG14 Wireless Gecko and is the answer not in the manual?