AN2364 Freescale Semiconductor / Motorola, AN2364 Datasheet - Page 28

no-image

AN2364

Manufacturer Part Number
AN2364
Description
Using the Table Stepper Motor TPU Function (TSM) with the MPC500 Family
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
tpu_tsm.c
{
/* Declare variables for channel designations */
28
/* if primary channel is 15 then secondary channel should be 0 */
UINT8 pchannel;
UINT8 param;
UINT8 i;
/* Establish channels used for TSM function */
/* set channel values to other channels based upon the master */
master_channel = channel;
param1_channel = (channel + 1) & 0xF;
param2_channel = (channel + 2) & 0xF;
param3_channel = (channel + 3) & 0xF;
/* disable channels so they can be configured safely */
tpu_disable( tpu, master_channel);
tpu_disable( tpu, param1_channel);
if (number_channels > 2) { tpu_disable( tpu, param2_channel); }
if (number_channels > 3) { tpu_disable( tpu, param3_channel); }
/* select TSM function for number of active channels */
/*
tpu_func( tpu, master_channel, TPU_FUNCTION_TSM);
tpu_func( tpu, param1_channel, TPU_FUNCTION_TSM);
if (number_channels > 2) { tpu_func( tpu, param2_channel, TPU_FUNCTION_TSM); }
if (number_channels > 3) { tpu_func( tpu, param3_channel, TPU_FUNCTION_TSM); }
/* disable interupts on channels so they can be configured safely */
tpu_interrupt_disable( tpu, master_channel);
tpu_interrupt_disable( tpu, param1_channel);
if (number_channels > 2) { tpu_interrupt_disable( tpu, param2_channel); }
if (number_channels > 3) { tpu_interrupt_disable( tpu, param3_channel); }
/* Initialize Parameter RAM
TSM is function 0xD
int master_channel;
int param1_channel;
int param2_channel;
int param3_channel;
Freescale Semiconductor, Inc.
Using the Table Stepper Motor TPU Function
For More Information On This Product,
*/
Go to: www.freescale.com
*/
MOTOROLA

Related parts for AN2364