English
Language : 

SH7708 Datasheet, PDF (345/625 Pages) Renesas Technology Corp – SuperH™ RISC engine
1 2 . 3 . 3 Reading the Time
Figure 12.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. Part (a) in figure 12.3 shows the method of reading
the time without using interrupts; part (b) in figure 12.3 shows the method using carry interrupts.
To keep programming simple, method (a) should normally be used.
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 12.3 Reading the Time
331