RL78/G1H CHAPTER 9 REAL-TIME CLOCK
R01UH0575EJ0120 Rev. 1.20 Page 258 of 920
Dec 22, 2016
9.4.5 Example of watch error correction of real-time clock
The watch can be corrected with high accuracy when it is slow or fast, by setting a value to the watch error
correction register.
The correction value used when correcting the count value of the internal counter (16-bit) is calculated by using
the following expression.
Set the DEV bit to 0 when the correction range is −63.1 ppm or less, or 63.1 ppm or more.
(When DEV = 0)
Correction value
Note
= Number of correction counts in 1 minute ÷ 3 = (Oscillation frequency ÷ Target frequency
− 1) × 32768 × 60 ÷ 3
(When DEV = 1)
Correction value
Note
= Number of correction counts in 1 minute = (Oscillation frequency ÷ Target frequency − 1)
× 32768 × 60
Note The correction value is the watch error correction value calculated by using bits 6 to 0 of the watch
error correction register (SUBCUD).
(When F6 = 0) Correction value = {(F5, F4, F3, F2, F1, F0) − 1} × 2
(When F6 = 1) Correction value = − {(/F5, /F4, /F3, /F2, /F1, /F0) + 1} × 2
When (F6, F5, F4, F3, F2, F1, F0) is (*, 0, 0, 0, 0, 0, *), watch error correction is not performed. “*” is
0 or 1.
/F5 to /F0 are bit-inverted values (000011 when 111100).
Remark 1. The correction value is 2, 4, 6, 8, … 120, 122, 124 or −2, −4, −6, −8, … −120, −122, −124.
Remark 2. The oscillation frequency is the count clock (f
RTC).
Remark 3. The target frequency is the frequency resulting after correction performed by using the watch error
correction register.
Example of calculating the correction value