English
Language : 

MC68HC908GT16_07 Datasheet, PDF (89/292 Pages) Freescale Semiconductor, Inc – Microcontrollers
Usage Notes
7.4.1 Switching Clock Sources
• Switching from one clock source to another requires both clock sources to be enabled and stable.
A simple flow requires:
• Enable desired clock source
• Wait for it to become stable
• Switch clocks
• Disable previous clock source
The key point to remember in this flow is that the clock source cannot be switched (CS cannot be written)
unless the desired clock is on and stable. A short assembly code example of how to employ this flow is
shown in Figure 7-9.
;* Clock Switching Code Example
;* This code switches from internal to external clock
;* Clock monitor and interrupts are not enabled
;* ICG Clock Switch
SwitchItoE:
bset ECGON,ICGCR
brclr ECGS,ICGCR,*
bset CS,ICGCR
bclr ICGON,ICGCR
; turn on external oscillator
; wait until external clock engaged
; select external clock for bus
; turn off internal clock (if desired)
Figure 7-9. Code Example for Switching Clock Sources
7.4.2 Enabling the Clock Monitor
Many applications require the clock monitor to determine if one of the clock sources has become inactive,
so the other can be used to recover from a potentially dangerous situation. Using the clock monitor
requires both clocks to be active (ECGON and ICGON both set). To enable the clock monitor, both clocks
also must be stable (ECGS and ICGS both set). This is to prevent the use of the clock monitor when a
clock is first turned on and potentially unstable.
Enabling the clock monitor and clock monitor interrupts requires a flow similar to this:
• Enable the alternate clock source
• Wait for both clock sources to be stable
• Switch to the desired clock source if necessary
• Enable the clock monitor
• Enable clock monitor interrupts
These events must happen in sequence. A short assembly code example of how to employ this flow is
shown in Figure 7-10.
MC68HC908GT16 • MC68HC908GT8 • MC68HC08GT16 Data Sheet, Rev. 5.0
Freescale Semiconductor
89