English
Language : 

SH7261 Datasheet, PDF (695/1348 Pages) Renesas Technology Corp – 32-Bit RISC Microcomputer SuperHTM RISC engine Family / SH7260 Series
15.4.3 Reading Time
Figure 15.3 shows how to read the time.
Section 15 Realtime Clock (RTC)
Disable the carry interrupt
Clear the carry flag
Read counter register
Yes
Carry flag = 1?
No
Write 0 to CIE in RCR1
Write 0 to CF in RCR1
(Set AF in RCR1 to 1 so that alarm
flag is not cleared.)
Read RCR1 and check CF bit
(a) To read the time without using interrupts
Clear the carry flag
Enable the carry interrupt
Clear the carry flag
Read counter register
Write 1 to CIE in RCR1
Write 0 to CF in RCR1
(Set AF in RCR1 to 1 so that alarm
flag is not cleared.)
Yes
interrupt
Read RCR1 and check CF bit
No
Disable the carry interrupt
Write 0 to CIE in RCR1
(b) To read the time using interrupts
Figure 15.3 Reading Time
If a carry occurs while reading the time, the correct time will not be obtained, so it must be read
again. Part (a) in figure 15.3 shows the method of reading the time without using interrupts; part
(b) in figure 15.3 shows the method using carry interrupts. To keep programming simple, method
(a) should normally be used.
Rev. 2.00 Sep. 07, 2007 Page 663 of 1312
REJ09B0320-0200