STFPC320
Real-time clock (RTC) operation
6.4.1
6.4.2
Reading the real-time clock
The real-time clock (RTC) is read by specifying the address corresponding to the register of
the real-time clock and then initiating a Read command. The RTC registers can then be
read in a sequential read mode. Since the clock runs continuously and a read takes a finite
amount of time, there is the possibility that the clock could change during the course of a
read operation. In this device, the time is latched by the read command (falling edge of the
clock on the ACK bit prior to RTC data output) into a separate latch to avoid time changes
during the read operation. The clock continues to run. Alarms occurring during a read are
unaffected by the read operation.
Writing to the real-time clock
The time and date may be set by writing to the RTC registers. To avoid changing the current
time by an uncompleted write operation, the current time value is loaded into a separate
buffer at the falling edge of the clock on the ACK bit before the RTC data input bytes, the
clock continues to run. The new serial input data replaces the values in the buffer. This new
RTC value is loaded back into the RTC register by a stop bit at the end of a valid write
sequence. An invalid write operation aborts the time update procedure and the contents of
the buffer are discarded. After a valid write operation the RTC will reflect the newly loaded
data beginning with the next “one second” clock cycle after the stop bit is written. The RTC
continues to update the time while an RTC register write is in progress and the RTC
continues to run during any nonvolatile write sequences. A single byte may be written to the
RTC without affecting the other bytes.
25/78