Полноценно запустилось в матлаб корректно. УПП может плавно открывать тиристоры пачкой импульсов
Начата работа над управлением УПП по командам
This commit is contained in:
@@ -16,6 +16,7 @@ MCU_CortexMemoryTypeDef MCU_CORTEX_MEM;
|
||||
// MCU PERIPH INIT
|
||||
void Initialize_Periph_Sim(void)
|
||||
{
|
||||
uwTick = hmcu.SystemClock / (MCU_CORE_CLOCK / 1000);
|
||||
Init_TIM_SIM();
|
||||
Init_ADC_SIM();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
"Initialize_Periph_Sim()"
|
||||
],
|
||||
"PeriphSimulation": [
|
||||
"uwTick = hmcu.SystemClock / (MCU_CORE_CLOCK / 1000)",
|
||||
"Simulate_Periph_Sim()"
|
||||
],
|
||||
"PeriphDeinit": [
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
// INPUT/OUTPUTS PARAMS START
|
||||
#define IN_PORT_NUMB 2
|
||||
#define ADC_PORT_1_WIDTH 6
|
||||
#define IN_PORT_2_WIDTH 1
|
||||
#define IN_PORT_2_WIDTH 16
|
||||
|
||||
#define OUT_PORT_NUMB 3
|
||||
#define THYR_PORT_1_WIDTH 6
|
||||
|
||||
@@ -24,6 +24,7 @@ void app_init(void) {
|
||||
MX_TIM8_Init();
|
||||
MX_TIM5_Init();
|
||||
MX_ADC3_Init();
|
||||
UPP_SetDefault(1, 1);
|
||||
UPP_Init();
|
||||
UPP_PreWhile();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
float dbg[16];
|
||||
|
||||
#define PIN_READ(_verbname_) (_verbname_##_GPIO_Port->ODR & (_verbname_##_Pin)) ? 0 : 1
|
||||
#define PIN_READ(_verbname_) (_verbname_##_GPIO_Port->ODR & (_verbname_##_Pin)) ? 1 : 0
|
||||
|
||||
void Write_Thyristors(real_T* Buffer, int ind_port)
|
||||
{
|
||||
@@ -66,6 +66,7 @@ void app_readInputs(const real_T* Buffer) {
|
||||
ADC_Set_Channel_Value(ADC3, 10, ReadInputArray(0,5));
|
||||
|
||||
alpha_dbg = ReadInputArray(1, 0);
|
||||
upp.call->go = ReadInputArray(1, 1);
|
||||
// USER APP INPUT END
|
||||
}
|
||||
|
||||
@@ -83,19 +84,19 @@ void app_writeOutputBuffer(real_T* Buffer) {
|
||||
|
||||
int nn = 0;
|
||||
//WriteOutputArray(upp.hangle.htim->Instance->CNT, 2, nn++);
|
||||
//WriteOutputArray((long long)(upp.hangle.htim->Instance->CCR1) - upp.hangle.htim->Instance->CNT, 2, nn++);
|
||||
//WriteOutputArray((long long)(upp.hangle.htim->Instance->CCR2) - upp.hangle.htim->Instance->CNT, 2, nn++);
|
||||
//WriteOutputArray((long long)(upp.hangle.htim->Instance->CCR3) - upp.hangle.htim->Instance->CNT, 2, nn++);
|
||||
WriteOutputArray((long long)(upp.hangle.htim->Instance->CCR1) - upp.hangle.htim->Instance->CNT, 2, nn++);
|
||||
WriteOutputArray((long long)(upp.hangle.htim->Instance->CCR2) - upp.hangle.htim->Instance->CNT, 2, nn++);
|
||||
WriteOutputArray((long long)(upp.hangle.htim->Instance->CCR3) - upp.hangle.htim->Instance->CNT, 2, nn++);
|
||||
|
||||
//WriteOutputArray(dbg[0], 2, nn++);
|
||||
//WriteOutputArray(dbg[1], 2, nn++);
|
||||
//WriteOutputArray(dbg[2], 2, nn++);
|
||||
|
||||
//WriteOutputArray(upp.hpwm.AllPhases[PHASE_A_POS].State, 2, nn++);
|
||||
//WriteOutputArray(upp.hpwm.AllPhases[PHASE_A_NEG].State, 2, nn++);
|
||||
//WriteOutputArray(upp.hpwm.AllPhases[PHASE_B_POS].State, 2, nn++);
|
||||
//WriteOutputArray(upp.hpwm.AllPhases[PHASE_B_NEG].State, 2, nn++);
|
||||
//WriteOutputArray(upp.hpwm.AllPhases[PHASE_C_POS].State, 2, nn++);
|
||||
//WriteOutputArray(upp.hpwm.AllPhases[PHASE_C_NEG].State, 2, nn++);
|
||||
WriteOutputArray(upp.hpwm.AllPhases[PHASE_A_POS].State, 2, nn++);
|
||||
WriteOutputArray(upp.hpwm.AllPhases[PHASE_A_NEG].State, 2, nn++);
|
||||
WriteOutputArray(upp.hpwm.AllPhases[PHASE_B_POS].State, 2, nn++);
|
||||
WriteOutputArray(upp.hpwm.AllPhases[PHASE_B_NEG].State, 2, nn++);
|
||||
WriteOutputArray(upp.hpwm.AllPhases[PHASE_C_POS].State, 2, nn++);
|
||||
WriteOutputArray(upp.hpwm.AllPhases[PHASE_C_NEG].State, 2, nn++);
|
||||
// USER APP OUTPUT END
|
||||
}
|
||||
@@ -9,7 +9,15 @@
|
||||
void app_step(void)
|
||||
{
|
||||
// USER APP STEP START
|
||||
UPP_While();
|
||||
|
||||
|
||||
static uint32_t uwTickPrev = 0;
|
||||
if (uwTickPrev != uwTick)
|
||||
{
|
||||
uwTickPrev = uwTick;
|
||||
UPP_Tick();
|
||||
}
|
||||
// USER APP STEP END
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user