English
Language : 

MC68HC908GT16 Datasheet, PDF (126/412 Pages) Motorola, Inc – Microcontrollers
Internal Clock Generator (ICG) Module
shown in Figure 7-8. This code is for illustrative purposes only and does
not represent valid syntax for any particular assembler.
start lda
loop **
sta
cmpa
bne
#$13
**
icgcr
icgcr
loop
;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
;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.
;Check to see if ECGS set, then CS set, then ICGON clear
;Keep looping until ICGON is clear.
Figure 7-8. Code Example for Switching Clock Sources
7.5.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
Technical Data
126
MC68HC908GT16 • MC68HC908GT8 — Rev. 2
Internal Clock Generator (ICG) Module
MOTOROLA