R01UH0136EJ0210 Rev.2.10
Page 777 of 800
Jul 31, 2012
M16C/64A Group
32. Usage Notes
32.15.4 Time Reading Procedure in Real-Time Clock Mode
In real-time clock mode, read time data bits
(1)
when the BSY bit in the RTCSEC register is 0 (not while
data is updated).
When reading multiple registers, if data is rewritten between reading registers, an errant time will be
read. To prevent this, use one of the following steps when reading:
•
Using an interrupt
In the real-time clock periodic interrupt routine, read the values necessary from the appropriate
time data bits.
•
Monitoring by a program 1
Monitor the IR bit in the RTCTIC register by a program and read necessary values of time data bits
after the IR bit becomes 1 (periodic interrupt requested).
•
Monitoring by a program 2
Read the time data according to Figure 32.11 “Time Data Reading”.
Figure 32.11 Time Data Reading
•
Using read results if they are the same value twice
(1) Read the values necessary from time data bits.
(2) Read the same bit as (1) and compare the contents.
(3) If the contents match, adopt that value as the correct value. If the contents do not match, repeat
until the read contents match with the previous contents.
Also, when reading multiple registers, read them as continuously as possible.
Note:
1.
Time data bits are as follows:
Bits SC12 to SC10 and SC03 to SC00 in the RTCSEC register
Bits MN12 to MN10 and MN03 to MN00 in the RTCMIN register
Bits HR11 to HR10 and HR03 to HR00 in the RTCHR register
Bits WK2 to WK0 in the RTCWK register
The RTCPM bit in the RTCCR1 register
Time data reading start
Time data reading
Time data reading end
No (updating)
Yes (not updating)
No (updating)
Yes (not updating)
The BSY bit in the
RTCSEC register is
0 (not while data is
updated)
The BSY bit in the
RTCSEC register is 0
(not while data is
updated)
Содержание M16C/60 Series
Страница 853: ...M16C 64A Group R01UH0136EJ0210...