AN2367 Freescale Semiconductor / Motorola, AN2367 Datasheet - Page 6

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 Routines
The TPU is flexible enough to support an application with Hall effect or optical sensors for commutation
and an encoder on the motor shaft for deriving speed and direction information. This may be beneficial in
environments where encoder information can not be relied upon to be completely accurate.
2.4
This programming note describes a number of routines which can be used to provide a simple and easy to
use interface. There are eight routines in total, and these are contained in two files – tpu_comm.h and
tpu_comm.c. The routines are defined in tpu_comm.c and the function prototypes are contained in
tpu_comm.h. The file tpu_comm.h needs to be included in any file that uses the routines.
The routines are written in C and examples of their use are provided. The examples make use of the standard
header files, provided for the MPC555, and the MPC500 utility routines.
The following routines are described in detail in the sections below:
2.4.1
This function is used to set up and initialize the selected TPU channels for the COMM function in Sensored
(HALLD) mode. In this mode the COMM function works in conjunction with the HALLD function, which
must also be set up and enabled on the TPU.
In order to avoid any unpredictable operation of the TPU, the function disables the selected channels before
configuring them for the COMM function. Clearing the appropriate bits in the CPRx registers disables the
TPU channels. If any function state is executing at the time the channel is disabled, it will continue until it
has completed. It is therefore advisable that, if the channels are used for any other TPU function prior to
their
tpu_comm_init_sensored.
The function has six parameters:
6
configuration
void tpu_comm_init_sensored (struct TPU3_tag *tpu, UINT8 channel, INT16 no_of_pins, INT16
update_period, INT16 comm_states[], INT16 no_of_states)
void tpu_comm_force_state (struct TPU3_tag *tpu, UINT8 channel, INT16 state_no)
void tpu_comm_init_sensorless_match (struct TPU3_tag *tpu, UINT8 channel, INT16
no_of_pins, INT16 counter_addr, INT16 update_period, INT16 comm_states[], INT16
no_of_states)
void tpu_comm_write_upper (struct TPU3_tag *tpu, UINT8 channel, INT16 upper)
void tpu_comm_write_lower (struct TPU3_tag *tpu, UINT8 channel, INT16 lower)
void tpu_comm_write_offset (struct TPU3_tag *tpu, UINT8 channel, INT16 offset)
INT16 tpu_comm_get_state_no (struct TPU3_tag *tpu, UINT8 channel)
void tpu_comm_start_update (struct TPU3_tag *tpu, UINT8 channel)
*tpu – This is a pointer to the TPU3 module to be used. It is of type TPU3_tag which is defined in
m_tpu3.h
channel – This is the channel selected as the master channel for the COMM function. The number
of pins required for commutation determines the number of channels used by COMM. The
additional required channels are adjacent to, and follow, the master channel in the TPU.
COMM Routines
void tpu_comm_init_sensored
Using the Multiphase Motor Commutation TPU Function
for
Freescale Semiconductor, Inc.
COMM,
For More Information On This Product,
Go to: www.freescale.com
an
appropriate
delay
is
implemented
before
MOTOROLA
calling

Related parts for AN2367