beautypg.com

Main software flowchart — main software loop, Figure 5-5, Software design – Motorola M68HC08 User Manual

Page 86: Freescale semiconductor, inc

background image

Software Design

Designer Reference Manual

DRM028 — Rev 0

86

Software Design

MOTOROLA

Figure 5-5. Main Software Flowchart — Main Software Loop

STAND-BY

– CHECK START STOP SWITCH

– IF PC MASTER S/W MODE:

CHECK STARTCTRL

FLAG

– IF RUN CONDITIONS:

SET STOP_F FLAG

ALIGNMENT STATE:

– TIME ALIGNMENT (TIMER3)

– APPLY VOLTAGE

– CURRENT CONTROL LOOP

– IF STOP OR FAULT CONDITION:

STOP MOTOR

EXIT RUNNING STATE

STARTING (ACQUISITION) STATE:

– PWM INCREMENT OF

– STARTINCROUTREGS8

– SET SPEED REGULATOR INTEGRAL

PORTION ACCORDING TO
CUR- RENT REGULATOR

– FIRST COMMUTATION STEP

– SECOND COMMUTATION STEP

– ACQUISITION STATE MOTOR

COMMUTATION LOOP

– IF I_CNTR_FOK SUCCESSIVE

CORRECT COMMUTATIONS:

EXIT STARTING (AQ.) STATE

– IF STOP OR FAULT CONDITION:

STOP MOTOR

EXIT RUNNING STATE

APPLICATION INITIALIZATION:

– CURRENT OFFSET CALIBRATION

– SYSTEM REGISTERS INITIALIZATION

– PWM INITIALIZATION

– TIMER 1 CURRENT SENSING TO PWM

SYNCHRONIZATION

– ADC MEASUREMENT INIT.

Stop_F Flag

DC-Bus over-voltage

YES

NO

YES

NO

RUNNING:

– SET TIMER PERIOD FOR SPEED

REGULATOR (VIRTUAL TIMER3)

– MOTOR COMMUTATION CONTROL

LOOP

– MOTOR SPEED CONTROL LOOP

– IF STOP OR FAULT CONDITION:

STOP MOTOR

EXIT RUNNING STATE

Stop_F Flag or Failure

Stop_F Flag or Failure

FAULT STATE:

– STOP MOTOR

– WAIT UNTIL FAULT CLEAR

– SET FAILURE.B.VOLTAGEFAILURE

Stop_F Flag or Failure

FAILURE

YES

NO

YES

NO

NO

YES

YES

NO

STATE:

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

.

..