Freescale Semiconductor, Inc.
GENERAL RELEASE SPECIFICATION
Since neither the output compare flag (OCF) nor the output compare registers are
affected by reset, care must be exercised when initializing the output compare
function. The following procedure is recommended:
8
2
1. Block interrupts by setting the I bit in the condition code register (CCR).
2. Write the MSB of the output compare register pair (OCRH) to inhibit further
compares until the LSB is written.
3
3. Read the timer status register (TSR) to arm the output compare flag (OCF).
4
4. Write the LSB of the output compare register pair (OCRL) to enable the
output compare function and to clear its flag (and interrupt).
5
5. Unblock interrupts by clearing the I bit in the CCR.
6
This procedure prevents the output compare flag bit (OCF) from being set between
the time it is read and the time the output compare registers are updated. A
software example is shown in Figure 10-7.
7
8
SEI
.
9B
.
BLOCK INTERRUPTS
.
.
.
9
.
.
.
.
.
XX
XX
16
13
17
.
LDA
LDX
STA
LDA
STX
.
B6
BE
B7
B6
BF
.
DATAH
DATAL
OCRH
TSR
OCRL
.
HI BYTE FOR COMPARE
LO BYTE FOR COMPARE
INHIBIT OUTPUT COMPARE
ARM OCF BIT TO CLEAR
READY FOR NEXT COMPARE
.
10
11
12
13
14
A
Figure 10-7. Output Compare Software Initialization Example
16
17
18
19
20
16-BIT TIMER
Rev. 1.0
For More Information On This Product,
Go to: www.freescale.com