
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 355 of 728
Aug 05, 2011
18.3.3.2
Time Reading Procedure
If the data of seconds, minutes, hours, days of the week, days, months, or years is updated while reading the
resulting an error of approximately 1 minute.
There are the following four methods for reading a correct time:
Program monitoring method 1
Check the BSY bit in the TRESEC register, and read the data registers of seconds, minutes, hours, days of the
week, days, months, and years after the BSY bit changes from 1 to 0. After the BSY bit is set to 1, the registers
are updated after approximately 15.625 ms, and then this bit is set to 0.
Program monitoring method 2
Read the data registers of seconds, minutes, hours, days of the week, days, months, and years in the following
order:
(1) Enable a periodic interrupt.
(2) Monitor the RTCF bit in the TREIFR register.
(3) Confirm that the RTCF bit is set to 1 (interrupt requested).
(4) Check that the BSY bit is 0 (data not being updated).
(5) Read the above data registers.
Using an interrupt
Read the required contents of the data registers of seconds, minutes, hours, days of the week, days, months,
and years in the timer RE2 interrupt routine.
Using the values read only if they are the same value twice
Read the data registers of seconds, minutes, hours, days of the week, days, months, and years consecutively
twice, and use the data if the read data is the same.
Figure 18.7
Example when Correct Time is not Obtained
Proce
s
si
ng
flow
[Before update]
TREYR register = 06h, TREMON register = 07h, TREDY register = 28h, TREWK register = 05h,
TREHR register = 09h, TREMIN register = 53h, TRESEC register = 59h
BSY bit = 0 (data not being updated)
Read the year data register
06h
Read the month data register
07h
Read the day data register
28h
Read the day-of-the week data register 05h
Read the hour data register
09h
Read the minute data register
53h
Read the second data register
59h
BSY bit = 1 (data being updated)
[After update]
TREYR register = 06h, TREMON register = 07h, TREDY register = 28h, TREWK register = 05h,
TREHR register = 09h, TREMIN register = 54h, TRESEC register = 00h
BSY bit = 0 (data not being updated)
Read the second data register
00h