AN2364 Freescale Semiconductor / Motorola, AN2364 Datasheet - Page 29

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
/**************************************************/
/*
/**************************************************/
29
pchannel = param1_channel;
param = 0;
for (i=0; i<table_size; i++){
/* -initial DESIRED_POSITION and CURRENT_POSITION will be the same;
/* -initialize TPU_TSM_TABLE, slew period, start period, pin_sequence
tpu->PARM.R[master_channel][TPU_TSM_DESIRED_POSITION] = (INT16) (start_position);
tpu->PARM.R[master_channel][TPU_TSM_CURRENT_POSITION] = (INT16) (start_position);
tpu->PARM.R[master_channel][TPU_TSM_TABLE]
tpu->PARM.R[master_channel][TPU_TSM_SLEW_PERIOD] = (INT16) (slew_period);
tpu->PARM.R[master_channel][TPU_TSM_START_PERIOD] = (INT16) (start_period);
tpu->PARM.R[master_channel][TPU_TSM_PIN_SEQUENCE] = (INT16) (pin_sequence);
/* Configure the first channel as the primary channel and the following */
/* channel as the secondary channel.
tpu_hsq(tpu, master_channel, TPU_TSM_LOCAL_ACC_TBL | TPU_TSM_ROTATE_ONCE);
tpu_hsq(tpu, param1_channel, TPU_TSM_LOCAL_ACC_TBL | TPU_TSM_ROTATE_ONCE);
if(number_channels > 2) {
tpu_hsq(tpu, param2_channel, TPU_TSM_LOCAL_ACC_TBL | TPU_TSM_ROTATE_ONCE);
}
if(number_channels > 3) {
tpu_hsq(tpu, param3_channel, TPU_TSM_LOCAL_ACC_TBL | TPU_TSM_ROTATE_ONCE);
}
/* Initialize both channels */
tpu_hsr(tpu, master_channel, TPU_TSM_INIT_HI);
tpu_hsr(tpu, param1_channel, TPU_TSM_INIT_LO);
if(number_channels > 2) {
Configure the Channels.
tpu->PARM.R[pchannel][param++] = *table++;
if (param == 8){
}
param = 0;
pchannel++;
if (pchannel == 16) pchannel = 0;
}
Freescale Semiconductor, Inc.
Using the Table Stepper Motor TPU Function
For More Information On This Product,
Go to: www.freescale.com
= (INT16) (table_size_index);
*/
*/
*/
*/
MOTOROLA

Related parts for AN2364