using carry interrupts in (b). To keep the program simple, method (a) should be used in most cases.
Read the counter
Disable a carry interrupt request on RTC side
Clear the interrupt status flag
Enable a carry interrupt request on RTC side
Clear the interrupt status flag
Read the counter
IR flag = 1?
Interrupt?
Enable a carry interrupt request on RTC side
Clear the interrupt status flag
Write 1 to the RCR1.CIE bit
Write 0 to the ICU.IRn.IR flag corresponding to
the CUP interrupt
(a) To read the time without using interrupt
Yes
(b) To read the time using interrupts
Write 1 to the RCR1.CIE bit
Write 0 to the RCR1.CIE bit*
1
Yes
No
Read the counter again when the IR flag
corresponding to the CUP interrupt is 1
Write 0 to the ICU.IRn.IR flag corresponding to
the CUP interrupt
Write 0 to the ICU.IRn.IR flag corresponding to
the CUP interrupt
Disable a carry interrupt request on ICU side
Write 0 to the ICU.IERm.IENj bit corresponding to
the CUP interrupt
Enable a carry interrupt request on ICU side
Write 1 to the ICU.IERm.IENj bit corresponding to
the CUP interrupt
No
Note 1. Disable the interrupt if necessary.