mc68hc908kx8 Freescale Semiconductor, Inc, mc68hc908kx8 Datasheet - Page 79

no-image

mc68hc908kx8

Manufacturer Part Number
mc68hc908kx8
Description
M68hc08 Microcontrollers
Manufacturer
Freescale Semiconductor, Inc
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
mc68hc908kx8CDW
Manufacturer:
FSC
Quantity:
364
Part Number:
mc68hc908kx8CDW
Manufacturer:
FREESCALE
Quantity:
20 000
Part Number:
mc68hc908kx8CDWE
Manufacturer:
FREESCALE
Quantity:
20 000
Company:
Part Number:
mc68hc908kx8CDWE
Quantity:
588
Part Number:
mc68hc908kx8MDWE
Manufacturer:
MOT
Quantity:
6 238
Company:
Part Number:
mc68hc908kx8VP
Quantity:
13
start
loop
7.4.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, the following notes should be observed:
Freescale Semiconductor
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 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 must also be contained in the
CMISR.
Although the clock monitor can only be enabled when both clocks are stable (ICGS is set or ECGS
is set), it will remain set if one of the clocks goes unstable.
The clock monitor only works if the external slow (EXTSLOW) bit in the CONFIG (or MOR) register
is set to the correct value.
The internal and external clocks must both be enabled and running in order to use the clock
monitor.
When the clock monitor detects inactivity, the inactive clock is automatically deselected and the
active clock selected as the source for CGMXCLK and TBMCLK. The CMISR can use the state of
the CS bit to check which clock is inactive.
When the clock monitor detects inactivity, the application may have been subjected to extreme
conditions which may have affected other circuits. The CMISR should take any appropriate
precautions.
lda
**
sta
brset
cmpa
bne
#$AF
**
icgcr
6,ICGCR,error ;Verify CMF is not set
icgcr
loop
MC68HC908KX8 • MC68HC908KX2 • MC68HC08KX8 Data Sheet, Rev. 2.1
Figure 7-9. Code Example for Enabling the Clock Monitor
;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.
;Check if ECGS set, then CMON set, then CMIE set
;Keep looping until CMIE is set.
Usage Notes
79

Related parts for mc68hc908kx8