4RTC0
1365C–CASIC–03/02
Functional
Description
The RTC0 provides a full binary-coded decimal (BCD) clock that includes hours, min-
utes and seconds.
The RTC0 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 RTC0 is updated in real time at one-second intervals in normal mode for the
counters of seconds, at one-minute intervals for the counter of minutes and so on.
Due to the asynchronous operation of the RTC0 with respect to the rest of the chip, to
be certain that the value read in the RTC0 registers (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.
Alarm The RTC0 has three programmable fields: 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 hour/minute/second.
• If only the seconds field is enabled, then an alarm is generated every minute.
Error Checking A verification on user interface data is performed when accessing the hours, minutes,
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. Hour (BCD check, in 24-hour mode check range
00 - 23 and check that AM/PM flag is not set if RTC0 is set in 24-hour mode;in
12-hour mode check range 01 - 12)
2. Minute (check BCD and range 00 - 59)
3. 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.