STK17T88
Real Time Clock
The clock registers maintain time up to 9,999 years in
Reading the Clock
The user should halt internal updates to the real time clock registers before reading clock data to prevent reading of data in transition. Stopping the internal register updates does not affect clock accuracy.
Write a “1” to the read bit “R” (in the Flags register at 0x7FF0) to capture the current time in holding registers. Clock updates do not restart until a “0” is written to the read bit. The RTC registers can now be read while the internal clock continues to run.
Within 20ms after a “0” is written to the read bit, all real time clock registers are simultaneously updated.
Setting the Clock
Set the write bit “W” (in the Flags register at 0x7FF0) to a “1” enable the time to be set. The correct day, date and time can then be written into the real time clock registers in
Backup Power
The RTC is intended to keep time even when system power is lost. When primary power, VCC, drops below VSWITCH, the real time clock switches to the backup power supply connected to either the VRTCcap or VRTCbat pin.
The clock oscillator uses a maximum of 300 nanoamps at 2 volts to maximize the backup time available from the backup source.
You can power the real time clock with either a capacitor or a battery. Factors to be considered when choosing a backup power source include the expected duration of power outages and the cost and reliability
If you select a capacitor power source, connect the capacitor to the VRTCcap pin and leave the VRTCbat pin unconnected. Capacitor backup time values based on maximum current specs are shown below. Nominal times are approximately 3 times longer.
Capacitor Value | Backup Time |
0.1 F | 72 hours |
|
|
0.47 F | 14 days |
|
|
1.0 F | 30 days |
|
|
A capacitor has the obvious advantage of being more reliable and not containing hazardous materials. The capacitor is recharged every time the power is turned on so that the real time clock continues to have the same backup time over years of operation
If you select a battery power source, connect the battery to the VRTCbat pin and leave the VRTCcap pin unconnected. A 3V lithium is recommended for this application. The battery capacity should be chosen for the total anticipated cumulative
The real time clock is designed with a diode internally connected to the VRTCbat pin. This prevents the battery from ever being charged by the circuit.
Stopping and Starting the RTC Oscillator
The OSCEN bit in Calibration register at 0x7FF8 enables RTC oscillator operation. This bit is nonvolatile and shipped to customers in the “enabled” state (set to 0). OSCEN should be set to a 1 to preserve battery life while the system is in storage. This turns off the oscillator circuit extending the battery life. If the OSCEN bit goes from disabled to enabled, it typically takes 5 seconds (10 seconds max) for the oscillator to start.
The STK17T88 has the ability to detect oscillator failure due to loss of backup power. The failure is recorded by the OSCF (Oscillator Failed bit) of the Flags register (at address 0x7FF0). When the device is powered on (VCC goes above VSWITCH) the OSCEN bit is checked for “enabled” status. If the OSCEN bit is enabled and the oscillator is not active within 5 ms, the OSCF bit is set. The user should check for this condition and then write a 0 to clear the flag. When the OSCF flag bit, the real time clock registers are reset to the “Base Time” (see the section Setting the Clock on page 14, the value last written to the real time clock registers.
The value of OSCF should be reset to 0 when the real time clock registers are written for the first time. This initializes the state of this bit since it may have become set when the system was first powered on.
To reset OSCF, set the write bit “W” (in the Flags register at 0x7FF0) to a “1” to enable writes to the Flags register. Write a “0” to the OSCF bit and then reset the write bit to “0” to disable writes.
Calibrating The Clock
The RTC is driven by a quartz controlled oscillator with a nominal frequency of 32.768 KHz. Clock accuracy depends on the quality of the crystal specified (usually 35 ppm at 25 C). This error could equate to 1.53 minutes gain or loss per month. The STK17T88 employs a calibration circuit that can improve the accuracy to
The number of time pulses added or subtracted depends upon the value loaded into the five calibration bits found in Calibration register (at 0x7FF8). Adding counts speeds the clock up; subtracting counts slows the clock down. The Calibration bits occupy the five lower order bits of the register. These bits can be set to represent any value between 0 and 31 in binary form. Bit D5 is a Sign bit, where a “1” indicates positive calibration and a “0” indicates negative calibration. Calibration occurs during a 64 minute period. The first 62 minutes in the cycle may, once per
Document Number: | Page 14 of 22 |
[+] Feedback