Фикс полярности ШИМ для транзисторов

Фикс модели матлаб
This commit is contained in:
2026-02-09 17:24:12 +03:00
parent 3f81734212
commit 261c98d362
18 changed files with 303 additions and 65 deletions

View File

@@ -106,3 +106,30 @@
#define __WFE()
#define __DMB()
/**
\brief Reverse bit order of value
\details Reverses the bit order of the given value.
\param [in] value Value to reverse
\return Reversed value
*/
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
#define __RBIT __rbit
#else
__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
{
uint32_t result;
uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */
result = value; /* r will be reversed bits of v; first get LSB of v */
for (value >>= 1U; value != 0U; value >>= 1U)
{
result <<= 1U;
result |= value & 1U;
s--;
}
result <<= s; /* shift when v's highest bits are zero */
return result;
}
#endif

View File

@@ -84,6 +84,7 @@ set code_PERIPH=.\MCU_STM32_Matlab\stm32_matlab_conf.c^
.\MCU_STM32_Matlab\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c^
.\MCU_STM32_Matlab\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c^
.\MCU_STM32_Matlab\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c^
.\MCU_STM32_Matlab\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c^
.\MCU_STM32_Matlab\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c^
.\MCU_STM32_Matlab\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c^
.\MCU_STM32_Matlab\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c^

View File

@@ -23,6 +23,7 @@ void app_init(void) {
MX_TIM1_Init();
MX_TIM2_Init();
MX_TIM3_Init();
MX_USART6_UART_Init();
MX_TIM8_Init();
MX_TIM5_Init();
MX_ADC3_Init();

View File

@@ -125,6 +125,8 @@ void Write_AngleControl(real_T* Buffer, int ind_port)
WriteOutputArray(upp.hangle.Iref, ind_port, nn++);
WriteOutputArray(upp.hangle.Imeas, ind_port, nn++);
WriteOutputArray(upp.hangle.alpha, ind_port, nn++);
WriteOutputArray(upp.hangle.f.CurrentLimited, ind_port, nn++);
WriteOutputArray(upp.hangle.f.RazgonDone, ind_port, nn++);
#define get_diff(ccrx) ((long long)(upp.hangle.htim->Instance->ccrx) - upp.hangle.htim->Instance->CNT)

View File

@@ -2,6 +2,7 @@ clear all
IadcMax = 53;%200;%53;
VadcMax = 1216;
Va = 3;
Ts = 5e-6;
Vnom = 690;

Binary file not shown.