Download Print this page

Renesas M16C/50 Series User Manual page 150

Advertisement

M16C/5L Group, M16C/56 Group
8.7.3
Using the Oscillator Stop/Restart Detect Function
After oscillator stop is detected, if the main clock reoscillates, set the main clock back to the clock
source for the CPU clock and peripheral functions by a program. Figure 8.6 shows the Switching from
On-Chip Oscillator Clock to Main Clock.
Main clock stopped
Figure 8.6
Switching from On-Chip Oscillator Clock to Main Clock
The CM22 bit becomes 1 at the same time an oscillator stop/restart detect interrupt is generated. When
the CM22 bit is 1, the oscillator stop/restart detect interrupt is disabled. When setting the CM22 bit to 0
by a program, the oscillator stop/restart detect interrupt is enabled.
8.8
Interrupt
The oscillator stop/restart detect interrupt is a non-maskable interrupt.
The watchdog timer interrupt, oscillator stop/restart detect interrupt, and voltage monitor 2 interrupt share
the same vector. When using multiple interrupts together, read the detect flags of the events in the
interrupt processing program, and determine the source of the interrupt.
The detect flag for oscillator stop/restart detect is the CM22 bit in the CM2 register. After the interrupt
source is determined, set the CM22 bit to 0 (not detected).
R01UH0127EJ0110 Rev.1.10
Sep 01, 2011
Switch the main clock
Check several times whether
the CM23 bit is 0
(main clock oscillates)
Main clock oscillating
Set the CM06 bit to 1
(divide-by-8)
Set the CM22 bit to 0
(main clock stop/restart not detected)
Set the CM21 bit to 0
(main clock or PLL clock)
End
CM06
: Bit in the CM0 register
CM21 to CM23
: Bits in the CM2 register
8. Clock Generator
Page 113 of 803

Advertisement

loading