6.4 Software Listing
DRM046 — Rev 0
MOTOROLA
Freescale Semiconductor, Inc.
PTB = BLDC_COMMUTATION_TABLE_CCW[ucSensorVector];
where ucSensorVector is the Hall sensor pattern evaluated from
actual state of Hall Sensor.
The software listing is also available for this Application Note. Special
attention was given to the modularity of the code. The code is written in
®
C (Metrowerks
CodeWarrior
The software consists of the application source code
BLDCwithHS_908QY4.c and application header file
BLDCwithHS_908QY4.h. The software includes the following software
routines:
•
main() - It is the entry point following a Reset. It calls the
initialization routines and contains the Software Timer.
•
MCUInit() - contains initialization of MCU
•
ApplicationInit() - contains initialization of application
•
VariablesInit() - contains initialization of variables
•
StartUpVariablesInit() - contains initialization of variables required
for motor start-up
•
FaultISR() - contains ISR for DC-Bus over-current hardware fault
detection
•
OverFlowISR() - contains update of PWM duty cycle and the
determination and generation of the commutation vector based on
the Hall sensors
•
ScanAdc() - scans pot and DC-Bus voltage
•
GetReqSpeed() - contains calculation of required speed
•
SpeedRamp() - contains speed ramp and DC-Bus over-voltage
protection during deceleration
•
GetDutyCycle() - contains speed PI controller with calculation of
PWM output duty cycle
Software Design
For More Information On This Product,
Go to: www.freescale.com
®
for MC68HC08 microcontrollers).
Designer Reference Manual
Software Design
Software Listing
57