MC68HC908KX2 MOTOROLA [Motorola, Inc], MC68HC908KX2 Datasheet - Page 117

no-image

MC68HC908KX2

Manufacturer Part Number
MC68HC908KX2
Description
Microcontrollers
Manufacturer
MOTOROLA [Motorola, Inc]
Datasheet
7.5.2 Enabling the Clock Monitor
MC68HC908KX8 • MC68HC908KX2 • MC68HC08KX8 — Rev. 1.0
MOTOROLA
start
loop
lda
**
sta
brset
cmpa
bne
Figure 7-9. Code Example for Enabling the Clock Monitor
#$AF
**
icgcr
6,ICGCR,error ;Verify CMF is not set
icgcr
loop
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:
These events must happen in sequence. A short assembly code
example of how to employ this flow is shown in
for illustrative purposes only and does not represent valid syntax for any
particular assembler.
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
Internal Clock Generator Module (ICG)
;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.
Internal Clock Generator Module (ICG)
Figure
7-9. This code is
Technical Data
Usage Notes
117

Related parts for MC68HC908KX2