1.4.20.23 RTC_FrequencyCorrect Function

C

void RTC_FrequencyCorrect (int8_t correction)

Summary

Calibrate for too-slow or too-fast oscillator.

Description

This function allows the application to calibrate the RTC frequency. The RTC module will add or subtract cycles from the RTC prescaler to adjust the frequency in steps of approximately 1ppm. The provided correction value should be between -127 to 127. A positive correction value adds counts and increase the period, thus reducing the frequency. A negative count will have the reverse effect.

Precondition

RTC_Initialize must have been called for the associated RTC instance. The Generate Frequency Correction API option in MHC should have been selected.

Parameters

Param Description
correction Signed 8 bit correction value. If no correction is needed, set value to zero

Returns

None.

Example

RTC_Initialize();

// Positive correction. This reduces frequency.
RTC_FrequencyCorrect(5);

// Negatvie correction. This increase frequency.
RTC_FrequencyCorrect(-10);

Remarks

None.