English
Language : 

XC164-16 Datasheet, PDF (73/417 Pages) Infineon Technologies AG – 16-Bit Single-Chip Microcontroller with C166SV2 Core Volume 2 (of 2): Peripheral Units
XC164-16 Derivatives
Peripheral Units (Vol. 2 of 2)
Real Time Clock
Increased RTC Accuracy through Software Correction
The accuracy of the XC164’s RTC is determined by the oscillator frequency and by the
respective prescaling factor (excluding or including T14 and the 8:1 prescaler). The
accuracy limit generated by the prescaler is due to the quantization of a binary counter
(where the average is zero), while the accuracy limit generated by the oscillator
frequency is due to the difference between the ideal and real frequencies (and therefore
accumulates over time). This effect is predictable and can be compensated. The total
accuracy of the RTC can be further increased via software for specific applications that
demand a high time accuracy.
The key to the improved accuracy is knowledge of the exact oscillator frequency. The
relation of this frequency to the expected ideal frequency is a measure of the RTC’s
deviation. The number of cycles, N, after which this deviation causes an error of ±1 cycle
can be easily computed. So, the only action is to correct the count by ±1 after each series
of N cycles. The correction may be made cyclically, for instance, within an interrupt
service routine, or by evaluating a formula when the RTC registers are read (for this the
respective “last” RTC value must be available somewhere).
Note: For the majority of applications, however, the standard accuracy provided by the
RTC’s structure will be more than sufficient.
Adjusting the current RTC value would require reading and then writing the complete
48-bit value. This can only be accomplished by three successive accesses each. To
avoid the hassle of reading/writing multi-word values, the RTC incorporates a correction
option to simply add or suppress one count pulse.
This is done by setting bit T14INC or T14DEC, respectively, in register RTC_CON. This
will add an extra count pulse (T14INC) upon the next count event, or suppress the next
count event (T14DEC). The respective bit remains set until its associated action has
been performed and is automatically cleared by hardware after this event.
Note: Setting both bits, T14INC and T14DEC, at the same time will have no effect on the
count values.
User’s Manual
RTC_X41, V2.1
15-4
V2.1, 2004-03