RL78/G13 Safety Function (Frequency Detection)
5.8.6 Real-Time Clock Setup
Figure 5.7 shows the flowchart for setting up the real-time clock.
R_RTC_Create()
return
Supply clock to real-time clock
RTCEN bit 1
Stop real-time clock
RTCE bit 0
Disable fixed-frequency interrupts
RTCMK bit 1
Clear fixed-frequency interrupt request
flag
RTCIF bit 0
: Interval timer operates on low-speed on-chip
oscillator clock (f
IL
= 15 kHz) because the OSMC
register is set to 0x10.
Set real-time clock interrupt priority level
to 3
RTCPR1 bit 1
RTCPR0 bit 1
RTCC0 register 0001H
RTCE bit = 0: Stop counter
RCLOE1 bit = 0: Disable 1-Hz output from RTC
AMPM bit = 0: 12-hour system
CT2-CT0 bit = 0001b: Fixed-frequency interrupt which
occurs once in 0.5 second
(f
SUB
/f
IL
)
Set up real-time clock operation
Figure 5.7 Real-Time Clock Setup
R01AN0956EJ0100 Rev. 1.00 Page 35 of 70
Feb. 27, 2012