1.2.19.23 1.3.22.23 1.4.20.23 1.5.21.23 1.6.21.23 1.7.22.23 1.29.21.23 1.30.15.33 1.31.15.33 1.32.24.23 1.33.15.33 1.37.15.33 1.38.20.23 1.39.17.23 1.40.19.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.