English
Language : 

SH7727 Datasheet, PDF (547/1109 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperH RISC engine Family/SH7700 Series
Section 16 Realtime Clock (RTC)
16.3.3 Reading the Time
Figure 16.3 shows how to read the time. If a carry occurs while reading the time, the correct time
will not be obtained, so it must be read again. The method of reading the time without using
interrupts is shown at (a) in figure 16.3, and the method using carry interrupts is shown at (b). To
keep the program simple, method (a) is used normally.
a. To read the time
without using interrupts
Disable the carry Write 0 to CIE in RCR1
interrupt
Clear the carry flag
Read counter
register
Write 0 to CF in RCR1
Note: Set AF to 1 so that alarm
flag is not cleared.
Yes
Carry flag = 1?
Read RCR1 and check CF
No
b. To use interrupts
Enable the carry
interrupt
Clear the carry flag
Read counter
register
Write 1 to CIE in RCR1,
and write 0 to CF in RCR1
Note: Set AF in RCR1 to 1 so that
alarm flag is not cleared.
Yes
Interrupt
generated?
No
Disable the carry
interrupt
Write 0 to CIE in RCR1
Figure 16.3 Reading the Time
Rev. 5.00 Dec 12, 2005 page 475 of 1034
REJ09B0254-0500