beautypg.com

4 main software flowchart, Main software flowchart – Motorola M68HC08 User Manual

Page 83

background image

Software Design

Main Software Flowchart

DRM028 — Rev 0

Designer Reference Manual

MOTOROLA

Software Design

83

3.2.5 Back-EMF Sensing Circuit

.The zero crossing selection is

provided by the multiplexer setting.

As shown in

Figure 5-2

, the commutation and back-EMF zero crossing

selection process is split into two actions:

Preset commutation and zero crossing selection

The preset means setting the buffered registers and RAM
variables for commutation

Set commutation and zero crossing selection

The setting means loading the registers with buffered variables

The implementation is described in

Implementation Notes

-

5.6.2

BLDC Commutation and Zero Crossing Selection

.

5.4 Main Software Flowchart

The main software flowchart incorporates the main routine entered from
the reset and interrupt states. The main routine includes initializing the
MCU and the main loop. The flowcharts are shown in

Figure 5-4

,

Figure 5-5

, and

Figure 5-6

.

MCU Initialization is entered only after system reset. It provides
initialization of system registers, ports, and CPU clock. The MCU
Initialization
is provided in MCUInit() function.

After MCU Initialization the Application Initialization is executed as
AppInit() function, which performs the following actions. First the zero
current offset of the dc-bus current measurement path is calibrated. This
offset on the ADC input should be 1.65 V at zero current. This is
implemented in the hardware design, in order to be able to measure
negative and positive current values. The status registers are initialized
and PWM generator is started. Also, timer 1 is started at the right
moment to be synchronized with the PWM generator. This way the
current measurement is executed at the defined moment of the PWM
signal.

F

re

e

sc

a

le

S

e

m

ic

o

n

d

u

c

to

r,

I

Freescale Semiconductor, Inc.

For More Information On This Product,

Go to: www.freescale.com

n

c

.

..