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

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
Set_Duty
Synopsis
Description
Input
Caution
See also
Code example
30/77
#include "mtc.h"
void Set_Duty(u16 duty)
This function is used to refresh the MCPUH/L register contents
(MCPVH/L in current mode).
The ‘duty’ is a u16 variable, and has to be set according to the PWM fre-
quency (MCPOH/L registers) for both voltage or current mode.
Duty = desired duty (0 to 100%) x MCPOH/L (voltage mode’)
Duty = desired current limitation (Amp) x MCPOH/L / 9.7(current mode)
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 (MCPVH/L, actually the current limitation) at the input of the MTC
cell comparator (MCCREF pin, via a RC filter on the board).
ST7MC Datasheet: MTC chapter.
Voltage mode:
20 Khz PWM frequency (ratio between 12-bit PWM clock and PWM fre-
quency, MCPOHL = 16 MHz/20kHz = 800), desired duty = 40%:
duty = 40 x MCPOHL/100 = 320
-> Update_Duty(320);
Current mode:
*Fixed 10 Khz PWM frequency (MCPOHL = 1600), desired current lim-
itation = 4 Amp:
duty = 4 x MCPOHL/9.7 = 4 x 1600/9.7 =
-> Update_Duty(660);
* hardware dependant. For other PWM frequencies, please check the
RC filter value at the input of the MTC comparator cell (MCCREF pin).
The desired duty cycle is set using this formula:

Related parts for AN1905