RL78/I1D
Operation state switching IAR
R01AN3597EJ0100 Rev.1.00
Page 32 of 42
Jan. 31, 2017
4.7.16.
Flash operation mode switching (HS) processing
Figure 4.18, Figure 4.19 shows the flowchart of the flash operation mode switching (HS) processing.
switch_flashmode_to_HS
Maskable interrupt enable
g_ad_busy
1
Set the regulator mode to
the normal setting
PMMC register
MCSEL bit
0
Set the high-speed on-chip oscillator
clock frequency to 8MHz
HOCODIV register
02H
High-speed on-chip oscillator
operating
HIOSTOP bit
0 : High-speed on-chip oscillator operating
MCS1 = 1?
Yes
No
Main on-chip oscillator clock status in the case of
middle-speed on-chip oscillator clock, switch to the
high-speed on-chip oscillator clock.
Set the high-speed on-chip
oscillator clock to
the main on-chip oscillator clock
MCM1 bit
0 : Select high-speed on-chip oscillator clock
MCS1 = 0?
Yes
No
Set the middle-speed on-chip
oscillator to stop
MIOEN bit
0 : Middle-speed on-chip oscillator stop
Wait until the status of the main on-chip oscillator clock is
switched to the high-speed on-chip oscillator clock
Set A/D conversion completion flag
to [busy]
A/D converter initialization
R_ADC_Create()
A/D conversion operation start
R_ADC_Start()
IE
1
A/D conversion operation
is completed?
Yes
No(branch in g_ad_busy = 1)
g_ad_busy
1
Set A/D conversion completion flag
to [busy]
B
Figure 4.18
Flash operation mode switching (HS) processing(1/2)