R01UH0136EJ0210 Rev.2.10
Page 104 of 800
Jul 31, 2012
M16C/64A Group
8. Clock Generator
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.
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, voltage monitor 1 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).
Switch the main clock
CM06
: Bit in the CM0 register
CM21 to CM23
: Bits in the CM2 register
Main clock oscillating
End
Check several times whether
the CM23 bit is 0
(main clock oscillates)
Main clock stopped
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)
Содержание M16C/60 Series
Страница 853: ...M16C 64A Group R01UH0136EJ0210...