
R8C/36T-A Group
18. Timer RE2
Under development Preliminary document
Specifications in this document are tentative and subject to change.
R01UH0240EJ0010 Rev.0.10
Page 356 of 728
Aug 05, 2011
18.3.4
Clock Error Correction Function
This function corrects input frequency errors in the fC1 clock. The correction amount is set by bits ADJ0 to
ADJ5 in the TREADJ register. The correction direction is set by bits MINUS and PLUS in the TREADJ
register. Time errors can be corrected by setting bits PLUS and MINUS to 10b (addition correction) when the
fC1 clock is slower than 32,768 Hz, and by setting these bits to 01b (subtraction correction) when the fC1 clock
is faster than 32,768 Hz.
18.3.4.1
Correction by Software
For correction by software, when 1 is written to the MINUS or PLUS bit once, correction is performed only for
correction by software, if the TADJSF bit in the TREIFR register is set to 1 (being corrected) immediately
before the counter value and the setting value of bits ADJ0 to ADJ5 are compared and match, subtraction
correction is performed during the current 1/16 second (refer to
Figure 18.9). If the TADJSF bit is set to 1
immediately after the counter value and the setting value of bits ADJ0 to ADJ5 are compared and match,
subtraction correction is performed during the next 1/16 second period (refer to
Figure 18.10).Figure 18.8
Operation Example of Addition Correction by Software
The above diagram applies under the following conditions:
AADJE bit in TRECR register = 0 (automatic correction function disabled (correction by software enabled))
M: Value set in bits ADJ0 to ADJ5 in TREADJ register
Write 1 to PLUS bit
First 1/16 second
Lower 11-bit counter
PLUS bit in
TREADJ register
TADJSF bit in
TREIFR register
Higher 4-bit counter
3 cycles of
count source
Addition correction ends
Lower 11-bit counter
overflow
Second 1/16 second
During the second 1/16 second, the count of the
correction amount for the M in 000h to (M - 1) is
omitted and the frequency is increased
7FFh
000h
001h
7FEh
7FFh
000h
001h
M
M + 1
A + 1
A
A + 2
A + 3