BAT32G1x9 user manual | Chapter 11 Real-time clock
455 / 1149
Rev.1.02
11.4
Operation of a real-time clock
11.4.1
The operation of the real-time clock begins
Figure 11-19
The start steps of the operation of the real-time clock
start
RTCEN=1
Note1
RTCE=0
configure RTCCL
configure AMPM
,
CT2~CT0
configure SEC
configure SEC
configure MIN
configure HOUR
configure WEEK
configure DAY
configure MONTH
configure YEAR
configure SUBCUD
Note2
clear IF interrupt flag
clear MK interrupt flag
RTCE=1
Note3
INTRTC=1?
Yes
No
end
configure to provide
input clock
configure to stop counting
configure f
RTC
。
select 12 hour system or 24
hours system and interrupt
(INTRTC)
configure second count
register
configure minute count
register
configure hour count
register
configure week count
register
configure day count register
configure month count
register
configure year count
register
configure clock deviation
calibration register
clear interrupt request flag
(Ifxx).
clear interrupt mask flag
(MKxx).
configure start counting
Concentrate:
1. The RTCEN position "1" must first be placed in the oscillation stable state of the count clock (fRTC).
2. This is just a case where the clock error needs to be corrected. For how to calculate the correction value, refer to
"Example of Clock Error Correction for 11.4.6 Real-Time Clocks".
3. In the case of transferring to sleep mode after the RTCE bit is "1" without waiting for the INRTC bit to change to "1",
confirm "1." 1.4.2 Start running after the transfer of sleep mode" steps.