English
Language : 

SH7730 Datasheet, PDF (591/1188 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperHTM RISC engine Family / SH7780 Series
Section 17 Realtime Clock (RTC)
17.4.3 Reading Time
Figure 17.3 shows how to read the time.
(a) To read the time
without using interrupts
Disable the carry interrupt
Clear the carry flag
Read counter register
Yes
Carry flag = 1?
No
(b) To use interrupts
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
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
No
Disable the carry interrupt
Read RCR1 and check CF bit
Write 0 to CIE in RCR1
Figure 17.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 17.3 shows the method of reading the time without using interrupts; part
(b) in figure 17.3 shows the method using carry interrupts. To keep programming simple, method
(a) should normally be used.
Rev. 1.00 Sep. 19, 2007 Page 543 of 1136
REJ09B0359-0100