Crystals only resonate at their rated frequency at a specified temperature, typically 25°C for 32.768KHz tuning-fork watch crystals. The crystal will resonate at lower frequencies at other temperatures. This is a property of the thermal expansion of quartz and is highly predictable. For minor changes in temperature this may not be an issue, but for temperatures further away from 25°C the variance in frequency may cause the RTCC to lose significant amounts of time. Many RTCC devices have a digital trimming or analog compensation scheme which can adjust for the frequency error to ensure accurate timekeeping.
The RTCC device uses the 32.768KHz oscillations to provide a clock to the internal counters as shown in Figure 2. A 15-bit counter overflows every 32,768 clocks (which is every second), providing a consistent time base. The counter feeds additional counters, which count the seconds, tens of seconds, minutes and so on, up to tens of years.
Figure 2: Internal counters of RTCC's
Alarms if available compare the current values of the time counters to the alarm registers. If there is a match, the RTCC will modify a flag bit in an internal register or change the state of an output pin.
RTCC's typically resonate a quartz crystal using an internal inverting amplifier circuit, as shown in figure 1. The amplifier is configured with two feedback paths between its output and input which cause it to resonate or oscillate.
Before the RTCC's amplifier is enabled the oscillator circuit is not resonating. On enabling the amplifier, thermal or background noise picked-up by the oscillator circuit is amplified and causes the system to begin to oscillate, and the oscillations quickly grow in amplitude.
The internal resistor, Rf, provides a non-frequency specific feedback path around the amplifier, which assists in starting oscillations, but it has relatively high impedance. The crystal has much lower impedance at the rated frequency and rapidly dominates over the internal resistor setting the frequency of the oscillations. The crystal is shaped such that it will vibrate at a specific frequency, most RTCC devices use a 32.768KHz crystal (often referred to as a watch crystal). Capacitors, C1 & C2, ensure stable oscillation. Their values are determined by the crystal used and other capacitance in the oscillator circuit.
Figure 1: RTCC with required external circuitry
Many electronic systems need to be able to "tell time", Real Time Clocks (RTC’s) also known as Real Time Clock Calendars (RTCC's) are often the time keepers for these electronic systems. "Real time" means that these devices keep time in an hors/minutes/seconds format. This is different than system time ticks which are used to control internal timing of digital systems. A RTCC device keeps track of the time in a people-friendly format allowing systems to track time in a way that is relevant and comprehensible by humans. This makes a RTCC a critical part of an application that needs to "tell time".
A RTCC works alongside a precision oscillator, normally a crystal, which can be internal or external to the RTCC device. The RTCC counts the oscillations to keep track of the time and date. They require a communication interface to configure the device and set or fetch the time. RTCC's typically also have alarms which can be set to alert the system at a specific times and dates.
Without Battery back-up the RTCC's recorded time would reset when the system loses power. Battery back-up allows the RTCC to switch over to an alternative power source when system power is not available. The alternative source powers the time keeping counters, oscillator circuitry and alarm circuits during this period, allowing the RTCC to continue to operate. Lithium coin cell batteries are often used as the alternative power source due to their low cost, widespread availability and convenient cell voltage.
The communications portion of the RTCC is disabled when operating from the alternative power source. By disabling the communications portion of the RTCC the current consumption is lowered allowing for longer operation from a disposable battery.
|Decimal||Hex||Binary Coded Decimal|
RTCC's record the time in BCD to simplify handling and user interfacing code.