2 time-of-day counter, 3 alarm, Time-of-day counter -3 – Motorola MC68VZ328 User Manual

Page 213: Alarm -3

Advertising
background image

RTC Overview

Real-Time Clock

11-3

The prescaler stages are tapped to support real-time interrupt features. A periodic interrupt at 1 Hz is
available, as well as an interrupt at the midnight rollover of the hours counter.

11.1.2

Time-of-Day Counter

Although the four counters that constitute the time-of-day counter are not restricted to operation as a
time-of-day counter, most designs use the counters in this fashion. The four counters (seconds, minutes,
hours, and days) are toggled by the 1 Hz clock from the prescaler. The seconds and minutes counters (each
6 bits) and the hours counter (5 bits) are maintained in the RTC timer register (RTCTIME). The day
counter (9 bits) can count up to 512 days and is located in its own register (DAYR). The four counters can
be read at any time. The seconds, minutes, and hours data is maintained in 24-hour time format, which
increments in day counts.

NOTE:

To allow maximum flexibility in design, each of the four counters in the
TOD clock can accept values that exceed their valid range. The
MC68VZ328 does not check for range validity. If an out-of-range value is
entered, the counter will reset to zero the next time it is incremented. For
example, if 26 is written to the hours counter, the counter will remain 26
until incremented by the minutes counters. When incremented, the hours
counter will return to zero. It is the responsibility of the user to ensure the
range validity of data in the TOD clock.

Each of the four counters may be enabled to produce an interrupt when it rolls over. Upon reaching 59, the
seconds and minutes counters each produce an MIN or HR interrupt (if enabled) the next time they are
incremented. Both counters reset to 00 and increment the next counter. Likewise, the hours counter, after
reaching a count of 23, produces an interrupt (DAY) with the next increment from the minutes counter.
The counter resets to 00 and increments the day counter.

11.1.3

Alarm

The alarm is composed of four registers that mirror those found in the time-of-day counter. The seconds,
minutes, and hours counters are in the RTC alarm register (RTCALRM). The day alarm register
(DAYALRM) contains the 9-bit DAYSAL field.

An alarm is set by accessing the RTCALRM and DAYALRM register and loading the days, hours,
minutes, and seconds for the time that the alarm is to generate an interrupt. The alarm is enabled when the
AL bit in the real-time interrupt enable register (RTCIENR) is set. When the time in the TOD counter
matches the time in the TOD alarm, the ALM bit in the real-time interrupt status register (RTCISR) is set.
If the alarm is not disabled, it will recur every 24 hours. If a single event alarm is desired, then the interrupt
service routine should change the values in the alarm registers or disable the ALM bit.

Advertising