CMS32L051 User Manual |Chapter 7 Real-Time Clock
www.mcu.com.cn 243 / 703
7.4.6 Example of clock error correction for a real-time clock
Clock fast and slow correction can be performed with high accuracy by setting the clock error correction
register.
The correction value when correcting the count value of the internal counter (16-bit) can be calculated
using the following calculation formula. When the correction range is outside the range of 4165.6ppm to
4165.6ppm, set 0 to DEV.
(In the case of DEV=0).
Correction value
Note
= 1 minute correction count value÷3 = (oscillation frequency÷target frequency
1) ×32768×60÷3
(In the case of DEV=1).
Correction value
Note
= 1 minute correction count value = (oscillation frequency÷target frequency
1) ×32768×60
Note Correction is the clock error correction value calculated from the value of bit12~0 of the clock error correction
register (SUBCUD).
(F12=0) Correction value = {(F11, F10, F9, F8, F7, F6, F5, F4, F3, F2, F1, F0) 1}×2
(F12=1) Correction value ={(/F11,/F10,/F9,/F8,/F7,/F6,/F5,/F4,/F3,/F2,/F1,/F0)+1}×2
When (F12~F0) = (*, 0,0,0,0,0,0,0,0,0,0,0,0,0,*), no correction for clock error is performed. * is 0 or 1.
/F12~/F0 is the value after you take the opposite (000000000011, 111111111100).
Remark: 1 The correction values are 2, 4, 6, 8, ... , 8186, 8188 or 2, 4, 6, 8, ...... , 8186, 8188.
2. The oscillation frequency is the value of the count clock (f
RTC
) and can be calculated with the following Formula:
The output frequency of the RTC1HZ pin at clock error correction register is 0 32768 at the initial value (00H).
3. The frequency of interest is the frequency that is corrected using the clock error correction register.