AN2367 Freescale Semiconductor / Motorola, AN2367 Datasheet - Page 13

no-image

AN2367

Manufacturer Part Number
AN2367
Description
Using the Multiphase Motor Commutation TPU Function (COMM)with the MPC500 Family
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
COMM Function Example
/*
/*
/*
/*
*/
/* The following loop of code is intended to demonstrate the operation of the
13
HALLD and COMM functions operating together. It will drive state values
onto the QADC_A PORTQA[0..2] pins. If these are connected to the HALLD
input channels(A, B and C], the HALLD function decodes the state values and
supplies the decoded state number to the COMM function which in turn drives
the appropriate commutation state value onto the TPU COMM channels */
force STATE_0 for COMM function on tpua, master channel 8 */
tpu_comm_force_state(tpua, 8, 0);
tpu_halld_init(tpua, 3, HALLD_DIRECTION_0, 0x0083,
HALLD_THREE_CHANNEL_MODE);
tpu_halld_enable(tpua, 3, TPU_PRIORITY_MIDDLE);
enable COMM function master channel (8) for middle priority */
tpu_enable(tpua, 8, TPU_PRIORITY_MIDDLE);
wait for end of service (force_state) */
while(tpu_get_hsr(tpua, 8)!=0);
set up HALLD function for 3 channel mode using channels 3, 4 and 5
initial value of DIRECTION = 0, state_no_address is set to 0x0083
to place the decoded STATE_NO value from HALLD into the required COMM
RAM location for STATE_NO
QADC_A.PORTQA.R = 0;
QADC_A.DDRQA.R = 0xFF00;
while(1)
{
tpu_halld_set_direction(tpua, 3, HALLD_DIRECTION_0);
for (state = 0; state < 8; state++)
{
Using the Multiphase Motor Commutation TPU Function
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA

Related parts for AN2367