Compare commits

...

2 Commits

Author SHA1 Message Date
bfcd696ccd тест тиристоров 2025-05-16 08:51:00 +03:00
f34eb8b900 тест zero cross detected 2025-05-16 08:25:29 +03:00
3 changed files with 14 additions and 5 deletions

@ -1 +1 @@
Subproject commit 08719ffc055e27b3b22a9c37742add86ece43ea4 Subproject commit a92cd95eeb67f97cbd0ce74966bde3971527cb4a

View File

@ -49,17 +49,23 @@ void tiristor_angle_control(TiristorControl_t *ctrl)
if ((uint16_t)((uint16_t)TIMER->CNT - ctrl->angle.start_delay_us) > ctrl->angle.delay_us) if ((uint16_t)((uint16_t)TIMER->CNT - ctrl->angle.start_delay_us) > ctrl->angle.delay_us)
{ {
#ifndef DISABLE_TIRISTOR_READY
if(ctrl->f.TiristorDone == 0) if(ctrl->f.TiristorDone == 0)
{ {
ctrl->f.EnableTiristor = 1; ctrl->f.EnableTiristor = 1;
ctrl->f.TiristorDone = 1; ctrl->f.TiristorDone = 1;
} }
#else
ctrl->f.EnableTiristor = 1;
#endif
} }
} }
void tiristor_start_angle_delay(TiristorControl_t *ctrl) void tiristor_start_angle_delay(TiristorControl_t *ctrl)
{ {
#ifndef DISABLE_TIRISTOR_READY
ctrl->f.TiristorDone = 0; ctrl->f.TiristorDone = 0;
#endif
ctrl->angle.start_delay_us = TIMER->CNT; ctrl->angle.start_delay_us = TIMER->CNT;
} }
@ -82,10 +88,10 @@ void tiristor_init(TiristorControl_t *ctrl, GPIO_TypeDef *gpiox, uint32_t gpio_p
ctrl->gpiox = gpiox; ctrl->gpiox = gpiox;
ctrl->gpio_pin = gpio_pin; ctrl->gpio_pin = gpio_pin;
ctrl->angle.delay_max_us = 8000; ctrl->angle.delay_max_us = 8000;
ctrl->angle.delay_min_us = 100; ctrl->angle.delay_min_us = 500;
ctrl->angle.delay_us = 7000; ctrl->angle.delay_us = 8000;
ctrl->angle.delay_step_us = 500; ctrl->angle.delay_step_us = 800;
ctrl->angle.sample_time_ms = 100; ctrl->angle.sample_time_ms = 20;
ctrl->open_time = 1; ctrl->open_time = 1;
TIMER->CR1 |= TIM_CR1_CEN; TIMER->CR1 |= TIM_CR1_CEN;
} }

View File

@ -10,12 +10,15 @@
#define TIMER TIM2 #define TIMER TIM2
#define DISABLE_TIRISTOR_READY
typedef struct typedef struct
{ {
unsigned EnableTiristor:1; unsigned EnableTiristor:1;
unsigned TiristorIsEnable:1; unsigned TiristorIsEnable:1;
#ifndef DISABLE_TIRISTOR_READY
unsigned TiristorDone:1; unsigned TiristorDone:1;
#endif
}TiristorControlFlags; }TiristorControlFlags;