AN2372 Freescale Semiconductor / Motorola, AN2372 Datasheet - Page 15

no-image

AN2372

Manufacturer Part Number
AN2372
Description
Using the Output Compare TPU Function (OC) with the MPC500Family
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Example B
The host sequence field bits are set to %01, to accumulate 16-bit periods and generate links. The host service
request bits are set to %10, for initialization.
Load parameter RAM as shown.
The OC function is set up on channel 3 in continuous pulse mode. Its parameters are initialized as follows:
CHANNEL_CONTROL is set to 0x008A. This captures and matches TCR1, forces the pin low on a match,
and forces the initial pin level low.
RATIO is an 8-bit fractional number between 0x00 and 0xFF used to scale the value indicated by
REF_ADDR2 to form the output pulse hightime. Here, REF_ADDR2 points to PPWA_LW. Thus, for the
input PPWA channel, PPWA_LW represents a period accumulation, while for the output OC channel,
it represents the unscaled output pulse hightime. The following equation relates the input period
accumulation in PPWA_LW, the desired output period, and RATIO:
T
In this equation, A
input channel, and T
channel. The factor of 2 is included since the OC channel scales the value in PPWA_LW to be the output
pulse hightime instead of the output pulse period. Thus, the scaled output pulse hightime must be multiplied
by two in order to calculate the output pulse period.
Solving this equation for RATIO yields the following:
RATIO = (To/Ai) * (255/2)
In this example, the desired ratio of the output period to the input period is 4/1. Since the accumulated value
in PPWA_LB represents sixteen input periods, To/Ai= 4/1 * 1/16 = 1/4. Thus, To/Ai * 255/2 = 1/4 * 255/2
= ~32 = ~0x20.
REF_ADDR1 points to a synchronization reference value used whenever a link is received that is not the
first link after initialization. Here, it points to LAST_ACCUM.
REF_ADDR2 points to a reference value used in calculating the output pulse hightime. Here, it points to
PPWA_LW.
REF_ADDR3 points to a synchronization reference value used when the first link service request is serviced
after initialization. Here, it points to LAST_ACCUM.
The host sequence field bits are initialized to%00, matches and pulses scheduled. The host service re- quest
bits are set to %11, initialization for the continuous mode.
Load parameter RAM as shown.
15
o
= 2 * A
0xYFFF0A
0xYFFF00
0xYFFF02
0xYFFF04
0xYFFF06
0xYFFF08
i
* (RATIO/255) seconds
X
X
X
0
0
1
i
is the accumulation value in PPWA_LW multiplied by the resolution of the timer for the
o
is the period of the output pulse multiplied by the resolution of the timer for the output
X
X
0
0
1
Freescale Semiconductor, Inc.
X
X
X
1
0
1
For More Information On This Product,
Using the Output Compare TPU Function
T a b l e 8 . P P W A C h a n n e l P a r a m e t e r R A M
X
X
X
1
1
1
Go to: www.freescale.com
X
X
X
0
0
1
X
X
X
0
0
1
0
0
X
X
1
X
X
X
X
1
0
1
X
0
0
X
X
0
X
X
X
0
0
0
X
X
X
0
0
0
X
X
X
0
0
0
X
X
X
1
0
0
0
0
X
X
0
X
MOTOROLA
1
0
X
X
0
X
X
X
X
1
0
0

Related parts for AN2372