AN1905 ST Microelectronics, Inc., AN1905 Datasheet - Page 32

no-image

AN1905

Manufacturer Part Number
AN1905
Description
St7mc Three-phase BLDC Motor Control Software Library
Manufacturer
ST Microelectronics, Inc.
Datasheet
ST7MC THREE-PHASE BLDC MOTOR CONTROL SOFTWARE LIBRARY
active_brake
Synopsis
Description
Input
Returns
Caution
Functions called
See also
Code example
32/77
#include "mtc.h"
BOOL active_brake(u16 duty, u16 time)
The purpose of this function is to switch the active brake of the motor, by
sinking a DC current in 1 phase, another one being grounded.
Duty cycle applied during active brake phase, with the Time given in
milli-seconds
TRUE if brake time elapsed or duty sets to 0.
MTC_EnableDirectAccess, MTC_DisableDirectAccess
ST7MC Datasheet: MTC chapter.
The ‘duty’ is a u16 variable, and has to be set according to the PWM fre-
quency (MCPOH/L registers).
Example:
PWM frequency set at 10 Khz, MCPOH/L = 1600 (ratio between 12-bit
PWM clock and PWM frequency 16 MHz/10kHz = 1600)
Desired duty = 40% = 40 x MCPOHL/100 = 40 x 1600/100 = 640
Desired braking time : 2 sec = 2000 ms
-> if (active_brake(640,2000) == TRUE) State = STOP; // stop motor
In voltage mode, the ‘Duty’ variable is directly linked to the PWM duty
cycle while in current mode, the ‘Duty’ variable sets the voltage refer-
ence at the input of the MTC cell comparator (MCCREF pin, via a RC
filter on the board).

Related parts for AN1905