Professional Documents
Culture Documents
8 See Figure 8
10
18
16
15
19
Speed BLDC
Demand Motor
+ Speed PI dsPIC®
CONTROL MODE 0 Σ Controller MCPWM
CLOSED VOLTS -
Calculated Motor Speed
Speed BLDC
Current Motor
Demand
Demand
+ Speed PI
Current dsPIC®
Σ Controller Σ PID MCPWM
CONTROL MODE 1 Controller
CLOSED CURRENT -
Motor Current
Voltage BLDC
Demand Motor
CONTROL MODE 2 dsPIC®
OPEN VOLTS MCPWM
Current BLDC
Demand Motor
+
Current dsPIC®
CONTROL MODE 3 Σ PID MCPWM
Controller
OPEN CURRENT -
Motor Current
System Reset
Clear
Yes
Invalid Reset? Watchdog
Timer
No
Call
PWM LED4
Peripheral Setup
at 20% Duty
Routines
Reset Power
Module and
Initialize LCD
Set Up Traps
and Interrupts
run_state = INITIALIZE
Initialize Variables
That Depend On
User Parameters
Clear
Watchdog
Timer
Call
slow_event_handler
Start
No
medium_event_count ==
10 ms?
Yes
medium_event_count = 0
Call debounce_switches
No
Calculate Phase
Advance
No
Call voltage_control
Yes
Call starting_code System Starting?
No
Finish
Start
No System acquiring
(Method 2)?
Yes rotation_timer–
rotation_timer > 0?
No
Finish
Start
No
slow_event_count
== 100ms?
Yes
Filter variables
for display purposes
Call process_switches
Call screen_handler
slow_event_count = 0
Finish
Start
slow_event_count++
medium_event_count++
Finish
Start
System in Yes
fault state?
No
Disable Firing
Over-Voltage or Yes
run_state = FAULT
Over-Current?
set trip_state
No
Call current_control
Yes Acquiring
Call acquire_position by Method 2?
No
Running
Yes Sensorless or
Call check_zero_crossing Acquiring using
Method 1?
No
Finish
Start
Yes
Read time-stamp from
QEI counter POSCNT
RETRY_flag = TRUE
RED flag Yes if (retry_counter > 0)
set? retry_counter–
ADCCONFIG = TRUE
No
No
Set WINDMILLING flag.
Open-loop commutate Reconstruct Zero X
motor with braking previous time-stamps
energization at current
speed Set flags to swap to sensorless
and force T2 Interrupt
Finish
= zero-crossing event
Start
Note: Clear ADCCONFIG.
ADCCONFIG == TRUE Initialize several variables
signifies that a commutation ADCCONFIG Yes and flags ready for next
has just occurred. == TRUE? zero crossing.
Load blanking_counter–
No
blanking_counter Yes
blanking_counter–
> 0?
No
Note:
Enough VPH No
From here onward assumes
Samples > VDC/2?
sector = 0. Therefore, falling edge
detect on VPH. Other sectors
differ in slope of edge detect. Yes
Sector 0 code is also unique as
period measurement is done.
Previous
and current VPH No
<= VDC/2?
Yes
Yes
Yes System No
Disable firing
lost?
Load PR2 with
commutation time and
enable T2 interrupt
Auto No run_state = FAULT
reacquire? trip_state = LOST
Save time-stamp and
Yes time delta
Yes
check_counter– check_counter > 0?
No
Yes
Load
adc_channel_config with
next value of ACHCHS
No
Acquisition No
Method 1?
Yes
Update sector
Finish
z =
Q1 Q3
z
z z
R Y B
Q4 Q6
Proportional Gain
X
Cumulative Internal
Error Gain
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip's Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.