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

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
The ‘BOOL Get_HVBus(void)’ returns a boolean. This function returns ‘TRUE’ if the voltage
of the HVBUS connected to channel AIN1 has reached the threshold level or if the voltage has
not yet returned to the threshold level minus the hysteresis value after an over-voltage detec-
tion.
In order to set the voltage and hysteresis threshold, the ‘HVBUS_THRESHOLD’ and
‘HVBUS_HYSTERIS’ values can be adjusted in the adc.c file.
4.3.3 it_ST7MC.c
This module contains all non-MTC related interrupt service routines. In the stand alone
firmware, the timer B resource is the only one to be used. The output compare capability is
used in order to decrease 2 different time bases, 10ms and 1ms (see ‘Timer.c’ file for the timer
B registers configuration).
Basically, unless equal to 0, variables are decreased by one each timer B output compare in-
terrupt event (every 10ms or 1ms for output compare 1 and 2 respectively). Therefore, a var-
iable ‘VAR’ is loaded with ‘50’ in the main code and decreased by one every 10 ms, and will
reach ‘0’ after 500ms (490 to 500 ms if the initialization of ‘VAR’ is done outside of the interrupt
routine).
Figure 26. Time base Principle: Timer B output compare 1 interrupt every 10ms
For more information regarding the configuration of this peripheral, please refer to the data
sheet of the MCU, ‘16-bit timer’ section.
46/77
Clear Status flag, refresh timer B output compare registers,
and update variables used for timing purpose
int
10 ms
Main routine:
int
VAR = 50
int
VAR = 49
int
VAR = 48
int
VAR = 47

Related parts for AN1905