Datasheet

78K0/Kx2-L CHAPTER 10 REAL-TIME COUNTER
R01UH0028EJ0400 Rev.4.00 386
Sep 27, 2010
10.4 Real-Time Counter Operation
10.4.1 Starting operation of real-time counter
Figure 10-19. Procedure for Starting Operation of Real-Time Counter
Setting AMPM, CT2 to CT0
Setting MIN
RTCE = 0
Setting SEC (clearing RSUBC)
Start
INTRTC = 1?
Stops counter operation.
Selects 12-/24-hour system and interrupt (INTRTC).
Sets second count register.
Sets minute count register.
No
Yes
Setting HOUR
Sets hour count register.
Setting WEEK
Sets week count register.
Setting DAY
Sets day count register.
Setting MONTH
Sets month count register.
Setting YEAR
Sets year count register.
Setting SUBCUD
Note 2
Sets watch error correction register.
Clearing IF flags of interrupt
Clears interrupt request flags (RTCIF, RTCIIF).
Clearing MK flags of interrupt
Clears interrupt mask flags (RTCMK, RTCIMK).
RTCE = 1
Note 3
Starts counter operation.
Reading counter
RTCEN = 1
Note 1
Supplies input clock.
Notes 1. First set RTCEN to 1, while oscillation of the subsystem clock (f
SUB) is stable.
2. Set up SUBCUD only if the watch error must be corrected. For details about how to calculate the
correction value, see 10.4.8 Example of watch error correction of real-time counter.
3. Confirm the procedure described in 10.4.2 Shifting to STOP mode after starting operation when
shifting to STOP mode without waiting for INTRTC = 1 after RTCE = 1.