74
1745E–ATARM–18-Apr-06
AT91M55800A
13.2 Functional Description
The RTC provides a full Binary-Coded Decimal (BCD) clock which includes century (19/20),
year (with leap years), month, date, day, hours, minutes and seconds.
The valid year range is 1900 to 2099, a two-hundred year Gregorian calendar achieving full
Y2K compliance.
The RTC can operate in 24-hour mode or in 12-hour mode with an AM/PM indicator.
Corrections for leap years are included (all years divisible by 4 being leap years, including
year 2000). This is correct up to the year 2099.
13.2.1 Timing
The RTC is updated in real-time at one second intervals in normal mode for the counters of
seconds, at 1 minute intervals for the counter of minutes and so on.
Due to the asynchronous operation of the RTC with respect to the rest of the chip, to be cer-
tain that the value read in the RTC registers (century, year, month, date, day, hours, minutes,
seconds) are valid and stable, it is necessary to read these registers twice. If the data is the
same both times, then it is valid. Therefore, a minimum of two and a maximum of three
accesses is required.
13.2.2 Alarm
The RTC has five programmable fields with which to program an alarm: MONTH and DATE in
the Calendar Alarm Register (RTC_CAR), and SEC, MIN and HOUR in the Time Alarm Regis-
ter (RTC_TAR). Each of these fields can be enabled or disabled using the bits MTHEN,
DATEN, SECEN, MINEN, HOUREN to match the alarm condition.
• If all the fields are enabled, an alarm flag is generated (the corresponding flag is asserted
and an interrupt generated if enabled) at a given month, date, hour, minute and second.
• If only the “seconds” field is enabled, then an alarm is generated every minute.
• Depending on the combination of fields enabled, a large number of possibilities are
available to the user ranging from minutes to 365/366 days.
13.2.3 Error Checking
A verification on user interface data is performed when accessing the century, year, month,
date, day, hours, minutes, seconds and alarms. A check is performed on illegal BCD entries
such as illegal date of the month with regards to the year and century configured.
If one of the time fields is not correct, the data is not loaded into the register/counter and a flag
is set in the Valid Entry Register (RTC_VER). This flag cannot be reset by the user. It is reset
as soon as an acceptable value is programmed. This avoids any further side effects in the
hardware. The same processing is done for the alarm.
The following checks are processed:
1. Century (check if it is in range 19 - 20)
2. Year (BCD entry check)
3. Date (check range 01 - 31)
4. Month (check if it is in BCD range 01 - 12,
check validity regarding “date”)
5. Day (check range 1 - 7)