4RTC1
1366C–CSAIC–03/02
Functional
Description
The RTC1 provides a full binary-coded decimal (BCD) clock, which includes day of the
week, hours, minutes and seconds.
The RTC1 can operate in 24-hour mode or in 12-hour mode with an AM/PM indicator.
Reference Clock The reference clock is CLK32768. It can be driven by the Atmel cell OSC33K (or an
equivalent cell) and an external 32.768 kHz crystal.
Timing The RTC1 is updated in real time at one-second intervals in normal mode for the second
counters, at one-minute intervals for the minute counters, and so on.
Due to the asynchronous operation of the RTC1 with respect to the rest of the chip, to
be certain that the value read in the RTC1 registers (day of the week, 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 are required.
Alarm The RTC1 has four programmable fields: day of the week, hours, minutes and seconds.
Each of these fields can be enabled or disabled 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 day/hour/minute/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 days.
Error Checking A verification on user interface data is performed when accessing the day, hours, min-
utes, seconds and alarms.
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 validity register. 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 procedure is done for the alarm.
The following checks are performed:
1. Day (check range 1-7)
2. Hour (BCD check: in 24-hour mode check range
00-23 and check that AM/PM flag is not set if RTC1 is set in 24-hour mode; in 12-
hour mode check range 01-12)
3. Minute (check BCD and range 00-59)
4. Second (check BCD and range 00-59)
Note: If the 12-hour mode is selected by means of the RTC_MODE register, a 12-hour value
can be programmed and the returned value on RTC_TIME will be the corresponding 24-
hour value. The entry control checks the value of the AM/PM indicator (bit 22 of
RTC_TIME register) to determine the range to be checked.