Renesas rl78 User Manual

Page of 1004
 
RL78/G1A 
 
CHAPTER  7   REAL-TIME  CLOCK 
7.4.6  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. 
 
Example of calculating the correction value  
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) 
 = Number of correction counts in 1 minute 
÷ 3 = (Oscillation frequency ÷ Target frequency − 1) 
¯ 32768 ¯ 60 
÷ 3 
Correction value
Note
 
(When DEV = 1) 
 = Number of correction counts in 1 minute = (Oscillation frequency 
÷ Target frequency − 1) ¯ 
32768 
¯ 60 
Note
Correction value
 
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). 
 
Remarks  1.  The correction value is 2, 4, 6, 8, … 120, 122, 124 or 
−2, −4, −6, −8, … −120, −122, −124. 
2.  The oscillation frequency is a value of the count clock (f
RTC
). 
It can be calculated from the output frequency of the RTC1HZ pin 
¯ 32768 when the watch error 
correction register is set to its initial value (00H). 
3.   The target frequency is the frequency resulting after correction performed by using the watch error 
correction register. 
 
R01UH0305EJ0200  Rev.2.00 
 
 
316  
Jul 04, 2013