Freescale Semiconductor, Inc.
Internal Clock Generator Module (ICG)
Usage Notes
8.5.1 Switching Clock Sources
Switching from one clock source to another requires both clock sources
to be enabled and stable. A simple flow requires:
1. Enable desired clock source
2. Wait for it to become stable
3. Switch clocks
4. 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 8-7. This code is for illustrative purposes only and does not
represent valid syntax for any particular assembler.
;Clock Switching Code Example
;This code switches from Internal to External clock
;Clock Monitor and interrupts are not enabled
;Mask for CS, ECGON, ECGS
;If switching from External to Internal, mask is $0C.
;Other code here, such as writing the COP, since ECGS may
;take some time to set
start lda
#$13
**
loop
**
sta
icgcr
;Try to set CS, ECGON and clear ICGON. ICGON will not
;clear until CS is set, and CS will not set until
;ECGON and ECGS are set.
cmpa
bne
icgcr
loop
;Check to see if ECGS set, then CS set, then ICGON clear
;Keep looping until ICGON is clear.
Figure 8-7. Code Example for Switching Clock Sources
MC68HC908RFRK2
MOTOROLA
AdvanceInformation
123
Internal Clock Generator Module (ICG)
For More Information On This Product,
Go to: www.freescale.com