AN2364 Freescale Semiconductor / Motorola, AN2364 Datasheet - Page 15

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
void tpu_tsm_init
The TPU will then accelerate, slew, and decelerate the motor to the desired position, issuing an interrupt
request to the CPU when the move is complete. If the master channel interrupt enable bit is set, then a CPU
interrupt will result. The CPU can issue a move request in this manner at any time, even while the motor is
still moving. In this case the current step is completed and the TPU then adjusts its strategy to move the
motor to the new DESIRED_POSITION as quickly as possible, even if this involves decelerating and
reversing direction - see later examples.
7
The following routines provide easy access, for the application developer, into the TSM function. Use of
these functions eliminate the need to directly control the TPU registers. There are eight functions added to
the application programming interface (API). The routines can be found in the tpu_tsm.h and tpu_tsm.c files
which should be included in the link file along with the top level development file(s). The first four functions
are used at the top application program level to directly operate the TSM function. The four other TSM
functions provide utility sub-routine
order and are listed below:
void tpu_tsm_init(struct TPU3_tag *tpu, UINT8 channel, UINT8 priority, INT16 start_position, UINT16
table_size_index, UINT16 slew_period, UINT16 start_period, UINT16 pin_sequence, UINT8
number_channels, UINT16 *table, UINT8 table_size);
7.1
This routine is used to initialize the channels of the TPU for the TSM function. This function has 11 input
parameters. Do not let the large number scare one away from using this function. Each function will be
handled one at a time and will handle all of the initialization requirements of the TSM function.
15
void tpu_tsm_init(struct TPU3_tag *tpu, UINT8 channel, UINT8 priority, INT16 start_position,
UINT16 table_size_index, UINT16 slew_period, UINT16 start_period, UINT16 pin_sequence,
UINT8 number_channels, UINT16 *table, UINT8 table_size);
void tpu_tsm_mov(struct TPU3_tag *tpu, UINT8 channel, UINT16 position);
UINT16 tpu_tsm_rd_dp(struct TPU3_tag *tpu, UINT8 channel);
UINT16 tpu_tsm_rd_cp(struct TPU3_tag *tpu, UINT8 channel);
UINT16 tpu_tsm_mas_chan_cier(int master_chan);
void tpu_tsm_int_lev(struct TPU3_tag *tpu, UINT8 level);
int tpu_tsm_int_chk(struct TPU3_tag *tpu, UINT16 channel);
void tpu_tsm_cisr_clr(struct TPU3_tag *tpu, UINT16 CISR_level);
*tpu -- This is the pointer to the TPU module chosen to run the TSM function. It is a structure of
type (name) TPU3_tag which is defined in m_tpu3.h.
channel -- This is the channel number of the primary TSM channel. The following channels will be
initialized as the parameter table channels.
priority -- This is the priority level which is assigned to all channels used for this TSM function.
This parameter should be assigned a value of: TPU_PRIORITY_HIGH,
TPU_PRIORITY_MIDDLE, or TPU_PRIORITY_LOW. The TPU priorities are defined in the file
mpc500_utils.h.
TSM Routines
void
tpu_tsm_init
Freescale Semiconductor, Inc.
Using the Table Stepper Motor TPU Function
For More Information On This Product,
activities and data manipulation. The routines will be described in
Go to: www.freescale.com
MOTOROLA

Related parts for AN2364