diff --git a/MATLAB/MCU_Wrapper/run_mex.bat b/MATLAB/MCU_Wrapper/run_mex.bat index fcf8cd9..c30c29f 100644 --- a/MATLAB/MCU_Wrapper/run_mex.bat +++ b/MATLAB/MCU_Wrapper/run_mex.bat @@ -1,16 +1,16 @@ @echo off -:: Получаем аргументы из командной строки +:: :: %1 - includes_USER :: %2 - code_USER -:: %3 - режим (например, debug) +:: %3 - (, debug) -:: Аргументы: -:: %1 — includes строка (в кавычках) -:: %2 — sources строка -:: %3 — defines строка -:: %4 — режим компиляции (debug/release) +:: : +:: %1 includes ( ) +:: %2 sources +:: %3 defines +:: %4 (debug/release) -:: Сохраняем как переменные +:: set filename=%~1 set includes_USER=%~2 set code_USER=%~3 @@ -18,7 +18,7 @@ set defines_USER=%~4 set defines_CONFIG=%~5 set compil_mode=%~6 -:: Заменяем __EQ__ на = +:: __EQ__ = set defines_USER=%defines_USER:__EQ__==% set defines_CONFIG=%defines_CONFIG:__EQ__==% @@ -29,7 +29,7 @@ set defines_WRAPPER=-D"MATLAB"^ -D"__sizeof_ptr=8" :: -------------------------WRAPPER PATHS AND CODE--------------------------- -:: оболочка, которая будет моделировать работу МК в симулинке +:: , :: WRAPPER BAT START set code_WRAPPER=.\MCU_Wrapper\MCU.c^ .\MCU_Wrapper\mcu_wrapper.c @@ -88,7 +88,7 @@ set defines= %defines_WRAPPER% %defines_CONFIG% %defines_USER% :: -------OUTPUT FOLDER-------- set output= -outdir "." -output %filename% -:: если нужен дебаг, до запускаем run_mex с припиской debug +:: , run_mex debug IF %compil_mode%==debug (set debug= -g) ::------------------------------------------------------------------------- @@ -145,9 +145,9 @@ if "%7"=="echo_enable" ( echo =========================== echo MODE: %compil_mode% echo =========================== -:: 1. ПРЕЖДЕ ЧЕМ КОМПИЛИРОВАТЬ - ВЫГРУЗИТЬ СТАРЫЙ ФАЙЛ +:: 1. - -:: 2. Компиляция с флагами для MSVC +:: 2. MSVC :: set LINK_EMBEDDED=/BASE:0x00000000 /FIXED:NO /FILEALIGN:0x1000 /FORCE:MULTIPLE /DYNAMICBASE:NO set C_EMBEDDED="-w" mex %output% %defines% %includes% %codes% %debug% CFLAGS="$CFLAGS %C_EMBEDDED%" LINKFLAGS="$LINKFLAGS %LINK_EMBEDDED%" diff --git a/MATLAB/app_wrapper/app_includes.h b/MATLAB/app_wrapper/app_includes.h index fed3040..7f49c25 100644 --- a/MATLAB/app_wrapper/app_includes.h +++ b/MATLAB/app_wrapper/app_includes.h @@ -15,6 +15,7 @@ #include "adc.h" #include "upp_main.h" #include "adc_tools.h" +#include "power_monitor.h" // INCLUDES END #endif //_APP_INCLUDES_H_ \ No newline at end of file diff --git a/MATLAB/app_wrapper/app_io.c b/MATLAB/app_wrapper/app_io.c index b7453ab..170e597 100644 --- a/MATLAB/app_wrapper/app_io.c +++ b/MATLAB/app_wrapper/app_io.c @@ -32,15 +32,12 @@ void ThyristorWrite(real_T* Buffer) */ void app_readInputs(const real_T* Buffer) { // USER APP INPUT START -ADC_Set_Channel_Value(ADC3, 4, ReadInputArray(0,0)); -ADC_Set_Channel_Value(ADC3, 5, ReadInputArray(0,1)); -ADC_Set_Channel_Value(ADC3, 6, ReadInputArray(0,2)); -ADC_Set_Channel_Value(ADC3, 7, ReadInputArray(0,3)); -ADC_Set_Channel_Value(ADC3, 8, ReadInputArray(0,4)); -ADC_Set_Channel_Value(ADC3, 10, ReadInputArray(0,5)); - - -__HAL_TIM_SET_AUTORELOAD(&adc_tim, ReadInputArray(1, 0)); + ADC_Set_Channel_Value(ADC3, 4, ReadInputArray(0,0)); + ADC_Set_Channel_Value(ADC3, 5, ReadInputArray(0,1)); + ADC_Set_Channel_Value(ADC3, 6, ReadInputArray(0,2)); + ADC_Set_Channel_Value(ADC3, 7, ReadInputArray(0,3)); + ADC_Set_Channel_Value(ADC3, 8, ReadInputArray(0,4)); + ADC_Set_Channel_Value(ADC3, 10, ReadInputArray(0,5)); // USER APP INPUT END } @@ -55,14 +52,14 @@ void app_writeOutputBuffer(real_T* Buffer) { //ThyristorWrite(Buffer); for (int i = 0; i < 2; i++) { - WriteOutputArray(ZC_Detected[i], 0, i); + WriteOutputArray(pm.ZC_Detected[i], 0, i); } - extern ADC_Periodic_t adc; - for(int i = 0; i < 6; i++) - { - WriteOutputArray(adc.Data[i], 1, i); - } + extern ADC_Periodic_t adc; + for(int i = 0; i < 6; i++) + { + WriteOutputArray(pm.adc.Data[i], 1, i); + } // USER APP OUTPUT END } \ No newline at end of file diff --git a/MATLAB/upp_r2023.slx b/MATLAB/upp_r2023.slx index e5540e5..f6f01fa 100644 Binary files a/MATLAB/upp_r2023.slx and b/MATLAB/upp_r2023.slx differ diff --git a/UPP/Core/Configs/upp_config.h b/UPP/Core/Configs/upp_config.h index 19180c0..38c29af 100644 --- a/UPP/Core/Configs/upp_config.h +++ b/UPP/Core/Configs/upp_config.h @@ -14,8 +14,9 @@ #define _UPP_CONFIG_H_ #include "stm32f4xx_hal.h" -///////////////////////////////////////////////////////////////////// -/////////////////////////---CALC DEFINES---////////////////////////// +#define PM_ADC_PERIOD 1800-1 +#define PM_ZERO_CROSS_HYSTERESIS_V 10 +#define PM_ZERO_CROSS_DEBOUNCE_10US 3 diff --git a/UPP/Core/PowerMonitor/adc_tools.c b/UPP/Core/PowerMonitor/adc_tools.c index 8603ffb..fc49b7a 100644 --- a/UPP/Core/PowerMonitor/adc_tools.c +++ b/UPP/Core/PowerMonitor/adc_tools.c @@ -25,11 +25,11 @@ static void ADC_InitAllFilters(ADC_Periodic_t *adc) Filter_Init(&adc->filter[i], Filter_Coef); } - FilterLUTInt_Init(&adc->temp_filter[0], + FilterLUTInt_Init(&adc->temp_map[0], (int32_t *)adc_temp_quants, (int32_t *)adc_temp_vals, sizeof(adc_temp_quants), 0); - FilterLUTInt_Init(&adc->temp_filter[1], + FilterLUTInt_Init(&adc->temp_map[1], (int32_t *)adc_temp_quants, (int32_t *)adc_temp_vals, sizeof(adc_temp_quants), 0); @@ -111,8 +111,8 @@ HAL_StatusTypeDef ADC_Start(ADC_Periodic_t *adc, uint16_t Period) } ADC_EnableAllFilters(adc); - Filter_Start(&adc->temp_filter[0]); - Filter_Start(&adc->temp_filter[1]); + Filter_Start(&adc->temp_map[0]); + Filter_Start(&adc->temp_map[1]); return res; } @@ -156,17 +156,20 @@ HAL_StatusTypeDef ADC_Handle(ADC_Periodic_t *adc) raw[i] = Filter_Process(&adc->filter[i], raw[i]); } } + // Перерасчеты Напряжений/Токов в единицы измерения - for(int i = 0; i < ADC_TEMP_CHANNELS_START; i++) + for(int i = 0; i < ADC_NUMB_OF_REGULAR_CHANNELS; i++) { ADC_Coefs_t *coefs = &adc->Coefs[i]; data[i] = ((float)(raw[i])-coefs->lZero) * coefs->vMax / (coefs->lMax-coefs->lZero); + ADC_UpdateStatistics(adc, i, ADC_LEVEL_AC); } // Преобразования температуры по таблице for (int i = ADC_TEMP_CHANNELS_START; i < ADC_NUMB_OF_CHANNELS; i++) { - data[i] = FilterLUTInt_Process(&adc->temp_filter[i-ADC_TEMP_CHANNELS_START], raw[i]); + data[i] = FilterLUTInt_Process(&adc->temp_map[i-ADC_TEMP_CHANNELS_START], raw[i]); + ADC_UpdateStatistics(adc, i, ADC_LEVEL_BASE); } @@ -181,13 +184,18 @@ HAL_StatusTypeDef ADC_Handle(ADC_Periodic_t *adc) /** * @brief Сбор статистики. */ -void ADC_UpdateStatistics(ADC_Periodic_t *adc, uint8_t channel, float value) +void ADC_UpdateStatistics(ADC_Periodic_t *adc, uint8_t channel, ADC_StatLevel_t level) { + if (level < ADC_LEVEL_BASE) + return; if(assert_adc(adc)) return; - if (channel >= ADC_NUMB_OF_REGULAR_CHANNELS) return; + if (channel >= ADC_NUMB_OF_REGULAR_CHANNELS) + return; + ADC_Statistics *stat = &adc->Stat[channel]; + float value = adc->Data[channel]; // Первая инициализация if (stat->SampleCount == 0) { @@ -201,6 +209,12 @@ void ADC_UpdateStatistics(ADC_Periodic_t *adc, uint8_t channel, float value) if (value > stat->Max) stat->Max = value; if (value < stat->Min) stat->Min = value; + // если не выбраны характеристики переменного сигнала - уходим + if(level < ADC_LEVEL_AC) + { + return; + } + // Накопление для Avg/RMS stat->Sum += value; stat->SumSquares += value * value; diff --git a/UPP/Core/PowerMonitor/adc_tools.h b/UPP/Core/PowerMonitor/adc_tools.h index bd22553..47fa0f6 100644 --- a/UPP/Core/PowerMonitor/adc_tools.h +++ b/UPP/Core/PowerMonitor/adc_tools.h @@ -10,8 +10,19 @@ #define _ADC_TOOLS_H_ #include "main.h" +#define ADC_CHANNEL_UBA 0 +#define ADC_CHANNEL_UAC 1 +#define ADC_CHANNEL_IC 2 +#define ADC_CHANNEL_IA 3 +#define ADC_CHANNEL_TEMP1 4 +#define ADC_CHANNEL_TEMP2 5 + + #define ADC_NUMB_OF_CHANNELS 6 -#define ADC_NUMB_OF_REGULAR_CHANNELS 4 +#define ADC_NUMB_OF_U_CHANNELS 2 +#define ADC_NUMB_OF_I_CHANNELS 2 +#define ADC_NUMB_OF_T_CHANNELS 2 +#define ADC_NUMB_OF_REGULAR_CHANNELS (ADC_NUMB_OF_U_CHANNELS+ADC_NUMB_OF_I_CHANNELS) #define ADC_TEMP_CHANNELS_START ADC_NUMB_OF_REGULAR_CHANNELS #define ADC_TEMPERATURES_QUANTS \ @@ -40,10 +51,10 @@ static const int32_t adc_temp_vals[] = ADC_TEMPERATURES; static const int32_t adc_temp_quants[] = ADC_TEMPERATURES_QUANTS; -#define Filter_t FilterAverageInt_t -#define Filter_Init FilterAverageInt_Init -#define Filter_Process FilterAverageInt_Process -#define Filter_Coef 10, FILTER_MODE_DEFAULT +#define Filter_t FilterMedianInt_t +#define Filter_Init FilterMedianInt_Init +#define Filter_Process FilterMedianInt_Process +#define Filter_Coef 10 /** * @brief Коэфициенты канала АЦП для пересчета в единицы измерения @@ -55,6 +66,13 @@ typedef struct uint16_t lMax; ///< Максимальный уровень АЦП (в квантах АЦП) }ADC_Coefs_t; +typedef enum +{ + ADC_LEVEL_DISABLE=0, ///< Базовая статистика - Max/Min + ADC_LEVEL_BASE, ///< Базовая статистика - Max/Min + ADC_LEVEL_AC, ///< Статистика для переменных сигналов - AVG, RMS +}ADC_StatLevel_t; + /** * @brief Статистика АЦП */ @@ -70,6 +88,8 @@ typedef struct float SumSquares; ///< Накопитель для RMS }ADC_Statistics; + + /** * @brief Хендл АЦП */ @@ -80,19 +100,20 @@ typedef struct ADC_HandleTypeDef *hadc; ///< Хендл АЦП // Data and calculation - uint16_t RawData[ADC_NUMB_OF_CHANNELS]; ///< Сырые значения АЦП - ADC_Coefs_t Coefs[ADC_NUMB_OF_REGULAR_CHANNELS]; ///< Коэффициенты @ref ADC_Coefs_t для регулярных каналов (не температуры) - Filter_t filter[ADC_NUMB_OF_CHANNELS]; ///< Фильтр от шумов АЦП - FilterLUTInt_t temp_filter[2]; ///< Коррекция нелинейности датчиков температуры + uint16_t RawData[ADC_NUMB_OF_CHANNELS]; ///< Сырые значения АЦП + ADC_Coefs_t Coefs[ADC_NUMB_OF_REGULAR_CHANNELS]; ///< Коэффициенты @ref ADC_Coefs_t для регулярных каналов (не температуры) - float Data[ADC_NUMB_OF_CHANNELS]; ///< Пересчитанные значения АЦП (в Вольтах/Амперах) - ADC_Statistics Stat[ADC_NUMB_OF_REGULAR_CHANNELS]; ///< Статистика для регулярных каналов (не температуры) + Filter_t filter[ADC_NUMB_OF_CHANNELS]; ///< Фильтр от шумов АЦП + FilterLUTInt_t temp_map[2]; ///< Коррекция нелинейности датчиков температуры + + float Data[ADC_NUMB_OF_CHANNELS]; ///< Пересчитанные значения АЦП (в Вольтах/Амперах) + ADC_Statistics Stat[ADC_NUMB_OF_REGULAR_CHANNELS]; ///< Статистика для регулярных каналов (не температуры) struct { - unsigned Initialized:1; - unsigned AdcRunning:1; - unsigned DataReady:1; + unsigned Initialized:1; ///< Флаг инициализированности структуры + unsigned AdcRunning:1; ///< Флаг АЦП в работе + unsigned DataReady:1; ///< Флаг данные АЦП обработаны }f; ///< Флаги uint32_t LastTick; // Время последнего преобразования }ADC_Periodic_t; @@ -107,9 +128,12 @@ HAL_StatusTypeDef ADC_ConfigChannel(ADC_Periodic_t *adc, int ChNumb, uint16_t le HAL_StatusTypeDef ADC_Start(ADC_Periodic_t *adc, uint16_t Period); /* Остановка АЦП. */ HAL_StatusTypeDef ADC_Stop(ADC_Periodic_t *adc); - -/* Остановка АЦП . */ +/* Обработка АЦП после получения данных. */ HAL_StatusTypeDef ADC_Handle(ADC_Periodic_t *adc); +/* Сбор статистики. */ +void ADC_UpdateStatistics(ADC_Periodic_t *adc, uint8_t channel, ADC_StatLevel_t level); +/* Сброс статистики. */ +void ADC_ResetStatistics(ADC_Periodic_t *adc, uint8_t channel); #endif //_ADC_TOOLS_H_ diff --git a/UPP/Core/PowerMonitor/power_monitor.c b/UPP/Core/PowerMonitor/power_monitor.c new file mode 100644 index 0000000..d456648 --- /dev/null +++ b/UPP/Core/PowerMonitor/power_monitor.c @@ -0,0 +1,63 @@ +/** +****************************************************************************** +* @file power_monitor.c +* @brief Модуль мониторящий сеть: Напряжение, Токи, Температуры +****************************************************************************** +* @details +******************************************************************************/ +#include "power_monitor.h" +#include "adc.h" +#include "tim.h" + + +HAL_StatusTypeDef PowerMonitor_Init(PowerMonitor_t *hpm) +{ + if(ADC_Init(&hpm->adc, &adc_tim, &hadc3) != HAL_OK) + return HAL_ERROR; + + if(ADC_ConfigChannel(&hpm->adc, ADC_CHANNEL_UBA, 2048, 1216, 4095) != HAL_OK) + return HAL_ERROR; + if(ADC_ConfigChannel(&hpm->adc, ADC_CHANNEL_UAC, 2048, 1216, 4095) != HAL_OK) + return HAL_ERROR; + if(ADC_ConfigChannel(&hpm->adc, ADC_CHANNEL_IC, 2048, 53, 4095) != HAL_OK) + return HAL_ERROR; + if(ADC_ConfigChannel(&hpm->adc, ADC_CHANNEL_IA, 2048, 53, 4095) != HAL_OK) + return HAL_ERROR; + + + if(ZC_Init(&hpm->zc, ADC_NUMB_OF_U_CHANNELS, PM_ZERO_CROSS_HYSTERESIS_V, PM_ZERO_CROSS_DEBOUNCE_10US) != HAL_OK) + return HAL_ERROR; + + if(ZC_ConfigChannel(&hpm->zc, ADC_CHANNEL_UBA, ZC_BOTH_EDGES) != HAL_OK) + return HAL_ERROR; + if(ZC_ConfigChannel(&hpm->zc, ADC_CHANNEL_UAC, ZC_BOTH_EDGES) != HAL_OK) + return HAL_ERROR; + + return HAL_OK; +} + + +HAL_StatusTypeDef PowerMonitor_Start(PowerMonitor_t *hpm) +{ + if(ADC_Start(&hpm->adc, PM_ADC_PERIOD) != HAL_OK) + return HAL_ERROR; + + return HAL_OK; +} + + + +void PowerMonitor_Handle(PowerMonitor_t *hpm) +{ + static uint32_t last_zc_cnt[ADC_NUMB_OF_U_CHANNELS] = {0}; + ADC_Handle(&hpm->adc); + ZC_ProcessAllChannels(&hpm->zc, hpm->adc.Data, uwTick); + for(int i = 0; i < ADC_NUMB_OF_U_CHANNELS; i++) + { + if(last_zc_cnt[i] != ZC_GetCrossCount(&hpm->zc, i)) + { + last_zc_cnt[i] = ZC_GetCrossCount(&hpm->zc, i); + hpm->ZC_Detected[i] = !hpm->ZC_Detected[i]; + } + } +} \ No newline at end of file diff --git a/UPP/Core/PowerMonitor/power_monitor.h b/UPP/Core/PowerMonitor/power_monitor.h new file mode 100644 index 0000000..ad34cf0 --- /dev/null +++ b/UPP/Core/PowerMonitor/power_monitor.h @@ -0,0 +1,32 @@ +/** +****************************************************************************** +* @file power_monitor.h +* @brief Модуль мониторящий сеть: Напряжение, Токи, Температуры +****************************************************************************** +*****************************************************************************/ +#ifndef _POWER_MONITOR_H_ +#define _POWER_MONITOR_H_ +#include "main.h" +#include "adc_tools.h" +#include "zero_cross.h" + +typedef struct +{ + ADC_Periodic_t adc; + ZeroCross_Handle_t zc; + uint32_t ZC_Detected[ADC_NUMB_OF_U_CHANNELS]; + + float U[3]; + float I[3]; + float T[3]; + +}PowerMonitor_t; +extern PowerMonitor_t pm; + + +HAL_StatusTypeDef PowerMonitor_Init(PowerMonitor_t *hpm); +HAL_StatusTypeDef PowerMonitor_Start(PowerMonitor_t *hpm); + +void PowerMonitor_Handle(PowerMonitor_t *hpm); + +#endif /* _POWER_MONITOR_H_ */ diff --git a/UPP/Core/Src/tim.c b/UPP/Core/Src/tim.c index d273fef..943d2fa 100644 --- a/UPP/Core/Src/tim.c +++ b/UPP/Core/Src/tim.c @@ -188,7 +188,7 @@ void MX_TIM8_Init(void) htim8.Instance = TIM8; htim8.Init.Prescaler = 0; htim8.Init.CounterMode = TIM_COUNTERMODE_UP; - htim8.Init.Period = 1000; + htim8.Init.Period = 1800-1; htim8.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim8.Init.RepetitionCounter = 0; htim8.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; diff --git a/UPP/Core/UPP/upp_main.c b/UPP/Core/UPP/upp_main.c index 47b7416..7f56710 100644 --- a/UPP/Core/UPP/upp_main.c +++ b/UPP/Core/UPP/upp_main.c @@ -5,22 +5,10 @@ ****************************************************************************** * @details ******************************************************************************/ -#include "main.h" // либы из AllLibs и вербальные имена из CubeMX #include "upp_main.h" // всё остальное по работе с УПП -#include "adc.h" -#include "tim.h" +#include "power_monitor.h" // статистика сети и АЦП -#include "adc_tools.h" -#include "zero_cross.h" -ADC_Periodic_t adc; -ZeroCross_Handle_t hzc; -uint32_t ZC_Detected[ZC_MAX_CHANNELS] = {0}; -#define ADC_CHANNEL_UBA 0 -#define ADC_CHANNEL_UAC 1 -#define ADC_CHANNEL_IC 2 -#define ADC_CHANNEL_IA 3 -#define ADC_CHANNEL_TEMP1 4 -#define ADC_CHANNEL_TEMP2 5 +PowerMonitor_t pm; /** * @brief Инициализация УПП. @@ -28,17 +16,7 @@ uint32_t ZC_Detected[ZC_MAX_CHANNELS] = {0}; */ int UPP_Init(void) { - ADC_Init(&adc, &adc_tim, &hadc3); - - ADC_ConfigChannel(&adc, ADC_CHANNEL_UBA, 2048, 1216, 4095); - ADC_ConfigChannel(&adc, ADC_CHANNEL_UAC, 2048, 1216, 4095); - ADC_ConfigChannel(&adc, ADC_CHANNEL_IC, 2048, 53, 4095); - ADC_ConfigChannel(&adc, ADC_CHANNEL_IA, 2048, 53, 4095); - - ZC_Init(&hzc, ZC_MAX_CHANNELS, 10, 3); - ZC_ConfigChannel(&hzc, 0, ZC_BOTH_EDGES); - ZC_ConfigChannel(&hzc, 1, ZC_BOTH_EDGES); - + PowerMonitor_Init(&pm); return 0; } @@ -48,7 +26,7 @@ int UPP_Init(void) */ int UPP_PreWhile(void) { - ADC_Start(&adc, 100); + PowerMonitor_Start(&pm); return 0; } @@ -64,15 +42,5 @@ int UPP_While(void) void UPP_ADC_Handle(void) { - static uint32_t last_zc_cnt[ZC_MAX_CHANNELS] = {0}; - ADC_Handle(&adc); - ZC_ProcessAllChannels(&hzc, adc.Data, uwTick); - for(int i = 0; i < ZC_MAX_CHANNELS; i++) - { - if(last_zc_cnt[i] != ZC_GetCrossCount(&hzc, i)) - { - last_zc_cnt[i] = ZC_GetCrossCount(&hzc, i); - ZC_Detected[i] = !ZC_Detected[i]; - } - } + PowerMonitor_Handle(&pm); } \ No newline at end of file diff --git a/UPP/Core/UPP/upp_main.h b/UPP/Core/UPP/upp_main.h index bc34d36..5ba7672 100644 --- a/UPP/Core/UPP/upp_main.h +++ b/UPP/Core/UPP/upp_main.h @@ -9,8 +9,11 @@ #ifndef _UPP_MAIN_H #define _UPP_MAIN_H +#include "main.h" // либы из AllLibs и вербальные имена из CubeMX #include "upp_config.h" + + /* Инициализация УПП */ int UPP_Init(void); /* Инициализация основного цикла УПП. */ @@ -19,5 +22,4 @@ int UPP_PreWhile(void); int UPP_While(void); void UPP_ADC_Handle(void); -extern uint32_t ZC_Detected[]; #endif //_UPP_MAIN_H \ No newline at end of file diff --git a/UPP/MDK-ARM/UPP.uvoptx b/UPP/MDK-ARM/UPP.uvoptx index 5a030cf..082976d 100644 --- a/UPP/MDK-ARM/UPP.uvoptx +++ b/UPP/MDK-ARM/UPP.uvoptx @@ -342,6 +342,30 @@ 0 0 0 + ..\Core\PowerMonitor\power_monitor.c + power_monitor.c + 0 + 0 + + + 3 + 13 + 5 + 0 + 0 + 0 + ..\Core\PowerMonitor\power_monitor.h + power_monitor.h + 0 + 0 + + + 3 + 14 + 1 + 0 + 0 + 0 ..\Core\PowerMonitor\adc_tools.c adc_tools.c 0 @@ -349,7 +373,7 @@ 3 - 13 + 15 5 0 0 @@ -361,7 +385,7 @@ 3 - 14 + 16 1 0 0 @@ -373,7 +397,7 @@ 3 - 15 + 17 5 0 0 @@ -401,7 +425,7 @@ 0 5 - 16 + 18 1 0 0 @@ -413,7 +437,7 @@ 5 - 17 + 19 1 0 0 @@ -425,7 +449,7 @@ 5 - 18 + 20 1 0 0 @@ -437,7 +461,7 @@ 5 - 19 + 21 1 0 0 @@ -449,7 +473,7 @@ 5 - 20 + 22 1 0 0 @@ -461,7 +485,7 @@ 5 - 21 + 23 1 0 0 @@ -473,7 +497,7 @@ 5 - 22 + 24 1 0 0 @@ -485,7 +509,7 @@ 5 - 23 + 25 1 0 0 @@ -497,7 +521,7 @@ 5 - 24 + 26 1 0 0 @@ -509,7 +533,7 @@ 5 - 25 + 27 1 0 0 @@ -521,7 +545,7 @@ 5 - 26 + 28 1 0 0 @@ -533,7 +557,7 @@ 5 - 27 + 29 1 0 0 @@ -545,7 +569,7 @@ 5 - 28 + 30 1 0 0 @@ -565,7 +589,7 @@ 0 6 - 29 + 31 5 0 0 @@ -577,7 +601,7 @@ 6 - 30 + 32 5 0 0 @@ -589,7 +613,7 @@ 6 - 31 + 33 5 0 0 @@ -601,7 +625,7 @@ 6 - 32 + 34 5 0 0 @@ -613,7 +637,7 @@ 6 - 33 + 35 5 0 0 @@ -625,7 +649,7 @@ 6 - 34 + 36 5 0 0 @@ -637,7 +661,7 @@ 6 - 35 + 37 1 0 0 @@ -649,7 +673,7 @@ 6 - 36 + 38 5 0 0 @@ -669,7 +693,7 @@ 0 7 - 37 + 39 1 0 0 @@ -681,7 +705,7 @@ 7 - 38 + 40 1 0 0 @@ -693,7 +717,7 @@ 7 - 39 + 41 1 0 0 @@ -705,7 +729,7 @@ 7 - 40 + 42 1 0 0 @@ -717,7 +741,7 @@ 7 - 41 + 43 1 0 0 @@ -729,7 +753,7 @@ 7 - 42 + 44 1 0 0 @@ -741,7 +765,7 @@ 7 - 43 + 45 1 0 0 @@ -753,7 +777,7 @@ 7 - 44 + 46 1 0 0 @@ -765,7 +789,7 @@ 7 - 45 + 47 1 0 0 @@ -777,7 +801,7 @@ 7 - 46 + 48 1 0 0 @@ -789,7 +813,7 @@ 7 - 47 + 49 1 0 0 @@ -801,7 +825,7 @@ 7 - 48 + 50 1 0 0 @@ -821,7 +845,7 @@ 0 8 - 49 + 51 1 0 0 @@ -833,7 +857,7 @@ 8 - 50 + 52 1 0 0 @@ -853,7 +877,7 @@ 0 9 - 51 + 53 1 0 0 @@ -865,7 +889,7 @@ 9 - 52 + 54 1 0 0 @@ -877,7 +901,7 @@ 9 - 53 + 55 1 0 0 @@ -889,7 +913,7 @@ 9 - 54 + 56 1 0 0 @@ -901,7 +925,7 @@ 9 - 55 + 57 1 0 0 @@ -921,7 +945,7 @@ 0 10 - 56 + 58 1 0 0 @@ -933,7 +957,7 @@ 10 - 57 + 59 1 0 0 @@ -945,7 +969,7 @@ 10 - 58 + 60 1 0 0 @@ -957,7 +981,7 @@ 10 - 59 + 61 1 0 0 @@ -969,7 +993,7 @@ 10 - 60 + 62 1 0 0 @@ -981,7 +1005,7 @@ 10 - 61 + 63 1 0 0 @@ -993,7 +1017,7 @@ 10 - 62 + 64 1 0 0 @@ -1005,7 +1029,7 @@ 10 - 63 + 65 1 0 0 @@ -1017,7 +1041,7 @@ 10 - 64 + 66 1 0 0 @@ -1029,7 +1053,7 @@ 10 - 65 + 67 1 0 0 @@ -1041,7 +1065,7 @@ 10 - 66 + 68 1 0 0 @@ -1053,7 +1077,7 @@ 10 - 67 + 69 1 0 0 @@ -1065,7 +1089,7 @@ 10 - 68 + 70 1 0 0 @@ -1077,7 +1101,7 @@ 10 - 69 + 71 1 0 0 @@ -1089,7 +1113,7 @@ 10 - 70 + 72 1 0 0 @@ -1101,7 +1125,7 @@ 10 - 71 + 73 1 0 0 @@ -1113,7 +1137,7 @@ 10 - 72 + 74 1 0 0 @@ -1125,7 +1149,7 @@ 10 - 73 + 75 1 0 0 @@ -1137,7 +1161,7 @@ 10 - 74 + 76 1 0 0 @@ -1149,7 +1173,7 @@ 10 - 75 + 77 1 0 0 @@ -1161,7 +1185,7 @@ 10 - 76 + 78 1 0 0 @@ -1173,7 +1197,7 @@ 10 - 77 + 79 1 0 0 @@ -1185,7 +1209,7 @@ 10 - 78 + 80 1 0 0 @@ -1197,7 +1221,7 @@ 10 - 79 + 81 1 0 0 @@ -1217,7 +1241,7 @@ 0 11 - 80 + 82 1 0 0 @@ -1237,7 +1261,7 @@ 0 12 - 81 + 83 2 0 0 @@ -1251,7 +1275,7 @@ ::CMSIS - 0 + 1 0 0 1 diff --git a/UPP/MDK-ARM/UPP.uvprojx b/UPP/MDK-ARM/UPP.uvprojx index e3192a8..02feebd 100644 --- a/UPP/MDK-ARM/UPP.uvprojx +++ b/UPP/MDK-ARM/UPP.uvprojx @@ -450,6 +450,16 @@ PowerMonitor + + power_monitor.c + 1 + ..\Core\PowerMonitor\power_monitor.c + + + power_monitor.h + 5 + ..\Core\PowerMonitor\power_monitor.h + adc_tools.c 1 @@ -915,6 +925,12 @@ + + + + + + diff --git a/UPP/UPP.ioc b/UPP/UPP.ioc index 5ea9b96..78d8d19 100644 --- a/UPP/UPP.ioc +++ b/UPP/UPP.ioc @@ -474,7 +474,7 @@ TIM3.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3 TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 TIM3.IPParameters=Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4 TIM8.IPParameters=Prescaler,Period,TIM_MasterSlaveMode,TIM_MasterOutputTrigger -TIM8.Period=1000 +TIM8.Period=1800-1 TIM8.Prescaler=0 TIM8.TIM_MasterOutputTrigger=TIM_TRGO_UPDATE TIM8.TIM_MasterSlaveMode=TIM_MASTERSLAVEMODE_DISABLE