The frequency characteristic of a crystal depends on the type of crystal. The frequency is normally specified by a parabolic curve centered around 25 °C. A common parabolic coefficient for a 32.768 kHz tuning fork crystal is –0.04 ppm/°C. Therefore, the crystal frequency can be represented as shown in This Equation.
Equation 7-2 f = f0[1 – (0.04 x 10-6) x (T–T0)2]
For example, a clock built using a regular 32.768 kHz crystal that keeps time at room temperature loses two minutes per year at 10°C above or below room temperature and loses eight minutes per year at 20°C above or below room temperature.
The impact of temperature on the crystal oscillator can be analyzed and tabulated in advance. The example in Table: Impact of Temperature on a Crystal Oscillator analyzes how much the crystal frequency changes with every 10°C of temperature change, and shows the change in the value to program in the calibration and fractional calibration registers. If the system has a mechanism to read the ambient temperature of the crystal, it could access this table and calibrate the RTC accordingly.