save
This commit is contained in:
18
Src/main.c
18
Src/main.c
@ -184,7 +184,9 @@ int main(void)
|
|||||||
// TIM4 -> ARR = 53; // for 1.735 MHz. It`s the highest frequency for correct ADC work. At higher freq artifacts (voltage peaks) appears.
|
// TIM4 -> ARR = 53; // for 1.735 MHz. It`s the highest frequency for correct ADC work. At higher freq artifacts (voltage peaks) appears.
|
||||||
//TIM4 -> ARR = 100; // for 1.735 MHz. It`s the highest frequency for correct ADC work. At higher freq artifacts (voltage peaks) appears.
|
//TIM4 -> ARR = 100; // for 1.735 MHz. It`s the highest frequency for correct ADC work. At higher freq artifacts (voltage peaks) appears.
|
||||||
|
|
||||||
TIM4 -> ARR = 37; //for 2.42 MHz. Highest freq for stm_ADC based on stm32G431-- 2.8 MHz
|
//TIM4 -> ARR = 37; //for 2.42 MHz. Highest freq for stm_ADC based on stm32G431-- 2.8 MHz
|
||||||
|
|
||||||
|
TIM4 -> ARR = 92*8 -1; //for 125 kHz
|
||||||
|
|
||||||
TIM4 -> CCR3 = (TIM4 -> ARR +1)/2 - 1;
|
TIM4 -> CCR3 = (TIM4 -> ARR +1)/2 - 1;
|
||||||
|
|
||||||
@ -441,8 +443,10 @@ int main(void)
|
|||||||
while(1);
|
while(1);
|
||||||
|
|
||||||
uint16_t step_counter = 0;
|
uint16_t step_counter = 0;
|
||||||
uint16_t trigger_counter = 0;
|
uint16_t trigger_counter = 3;
|
||||||
uint16_t trigger_step = (uint8_t )((task.max_param - task.current_param)/task.delta_param * 10);
|
//uint16_t trigger_step = (uint8_t )((task.max_param - task.current_param)/task.delta_param * 10);
|
||||||
|
uint16_t trigger_step = 50;
|
||||||
|
|
||||||
uint16_t task_sheduler = 0;
|
uint16_t task_sheduler = 0;
|
||||||
|
|
||||||
|
|
||||||
@ -495,12 +499,12 @@ int main(void)
|
|||||||
//HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_RESET);
|
//HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_RESET);
|
||||||
//*
|
//*
|
||||||
if (step_counter % trigger_step == 0){ //trigger at every 60 step
|
if (step_counter % trigger_step == 0){ //trigger at every 60 step
|
||||||
OUT_trigger(trigger_counter);
|
//OUT_trigger(trigger_counter);
|
||||||
++trigger_counter;
|
++trigger_counter;
|
||||||
}
|
}
|
||||||
++step_counter;
|
++step_counter;
|
||||||
|
|
||||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET); //stop trigger pulse
|
//HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET); //stop trigger pulse
|
||||||
//*/
|
//*/
|
||||||
/*
|
/*
|
||||||
++task_sheduler;
|
++task_sheduler;
|
||||||
@ -539,6 +543,9 @@ int main(void)
|
|||||||
HAL_GPIO_WritePin(OUT_6_GPIO_Port, OUT_6_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(OUT_6_GPIO_Port, OUT_6_Pin, GPIO_PIN_RESET);
|
||||||
HAL_GPIO_WritePin(OUT_7_GPIO_Port, OUT_7_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(OUT_7_GPIO_Port, OUT_7_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
|
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET); //stop trigger pulse
|
||||||
|
|
||||||
|
|
||||||
task.current_param = task.min_param;
|
task.current_param = task.min_param;
|
||||||
Set_LTEC(TT_CHANGE_CURR_1, task.current_param);
|
Set_LTEC(TT_CHANGE_CURR_1, task.current_param);
|
||||||
if (task.tau > 3)
|
if (task.tau > 3)
|
||||||
@ -2269,6 +2276,7 @@ void OUT_trigger(uint8_t out_n)
|
|||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
HAL_GPIO_WritePin(OUT_3_GPIO_Port, OUT_3_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(OUT_3_GPIO_Port, OUT_3_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
HAL_GPIO_WritePin(OUT_3_GPIO_Port, OUT_3_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(OUT_3_GPIO_Port, OUT_3_Pin, GPIO_PIN_RESET);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user