English
Language : 

MC68HC908GT16 Datasheet, PDF (127/412 Pages) Motorola, Inc – Microcontrollers
Internal Clock Generator (ICG) Module
Usage Notes
These events must happen in sequence. A short assembly code
example of how to employ this flow is shown in Figure 7-9. This code is
for illustrative purposes only and does not represent valid syntax for any
particular assembler.
start
loop
lda
**
sta
brset
cmpa
bne
#$AF
**
icgcr
6,ICGCR,error
icgcr
loop
;Clock Monitor Enabling Code Example
;This code turns on both clocks, selects the desired
; one, then turns on the Clock Monitor and Interrupts
;Mask for CMIE, CMON, ICGON, ICGS, ECGON, ECGS
; If Internal Clock desired, mask is $AF
; If External Clock desired, mask is $BF
; If interrupts not desired mask is $2F int; $3F ext
;Other code here, such as writing the COP, since ECGS
; and ICGS may take some time to set.
;Try to set CMIE. CMIE wont set until CMON set; CMON
; won’t set until ICGON, ICGS, ECGON, ECGS set.
;Verify CMF is not set
;Check if ECGS set, then CMON set, then CMIE set
;Keep looping until CMIE is set.
Figure 7-9. Code Example for Enabling the Clock Monitor
7.5.3 Using Clock Monitor Interrupts
The clock monitor circuit can be used to recover from perilous situations
such as crystal loss. To use the clock monitor effectively, these points
should be observed:
• Enable the clock monitor and clock monitor interrupts.
• The first statement in the clock monitor interrupt service routine
(CMISR) should be a read to the ICG control register (ICGCR) to
verify that the clock monitor flag (CMF) is set. This is also the first
step in clearing the CMF bit.
• The second statement in the CMISR should be a write to the
ICGCR to clear the CMF bit (write the bit low). Writing the bit high
will not affect it. This statement does not need to immediately
follow the first, but must be contained in the CMISR.
• The third statement in the CMISR should be to clear the CMON bit.
This is required to ensure proper reconfiguration of the reference
dividers. This statement also must be contained in the CMISR.
MC68HC908GT16 • MC68HC908GT8 — Rev. 2
MOTOROLA
Internal Clock Generator (ICG) Module
Technical Data
127