AN1915D Freescale Semiconductor / Motorola, AN1915D Datasheet - Page 18

no-image

AN1915D

Manufacturer Part Number
AN1915D
Description
3-Phase BLDC Motor Control with Quadrature Encoder using DSP56F80x
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
18
Software Design
5.1.1 Compare Interrupt
5.1.2 Period Measuring and Velocity Calculation
5.1.3 Speed Controller
The main data flow can be divided to four parts:
Speed control starts with the required speed omega_required_mech . This variable is set by user
buttons or remotely by the PC, within allowed limits. The variable omega_required_mech is
copied to omega_desired_mech at a defined moment. This variable is used as a shadow variable
to avoid change of the required speed from the PC at any time. The variable
omega_desired_mech is input to the speed PI controller as a reference value.
MeasuredTime incorporates a time period of one phase of Quadrature Encoder. The time period is
used for a speed calculation. Calculated speed, omega_actual_mech , is input to the speed PI
controller as a secondary input. The PI controller output determines the duty cycle of the generated
PWM output signals.
For the commutation, the Timer A0, set as a quadrature counter, is used. As soon as the timer A0
reaches any of compare values, a compare interrupt is called. The interrupt routine saves the actual
commutation sector to CommutationCounter . The CommutationCounter variable is input to
the mask and swap calculation, which calculates the final shape of the output voltage. The output
variable PWMState is written directly to the PWM block. The next task, which is provided by the
interrupt routine, is calculation of the spin direction. The result, DirectionSpinning, is used for
the speed calculation. Finally, the routine updates both the compare registers of Timer A0.
A variable u_dc_bus contains the actual DC-Bus voltage. The value is used for an under-voltage
detection.
The process Compare Interrupt is executed when the timer A0 reaches any of compare values. The
process identifies the spin direction. According to the spin direction, the process updates the compare
values to define the limit for the new commutation sector. The number of pulses for one commutation
sector is given by constant NORMAL_COMMUTATION_INTERVAL . Where the number of pulses is
not an integer there is a constant, SHORT_COMMUTATION_INTERVAL , which is applied once per
electrical revolution. This constant ensures that the number of pulses counted through one electrical
revolution is exactly the same as the number of pulses of the Quadrature Encoder. Where the number
of pulses for one commutation sector is an integer the constant SHORT_COMMUTATION_INTERVAL
is not implemented.
The processes, Period Measuring and Velocity Calculation, read the time between the adjacent edges
of
omega_actual_mech .
This process compares the required and actual speeds and calculates the duty cycle of the PWM output
signals. For detailed information see
one
Speed control
Velocity calculation
Rotor commutation
DC-Bus voltage measurement
phase
of
3-Phase BLDC Motor Control with Quadrature Encoder
Freescale Semiconductor, Inc.
the
For More Information On This Product,
Quadrature
Go to: www.freescale.com
Section 3.1.5, Speed
Encoder,
and
Control.
calculate
the
actual
motor
MOTOROLA
speed

Related parts for AN1915D