solved laser current setup timing issue
This commit is contained in:
12
Src/main.c
12
Src/main.c
@ -371,7 +371,7 @@ int main(void)
|
||||
Set_LTEC(TT_CHANGE_TEMP_2, temp16);//Drive Laser TEC 2
|
||||
|
||||
// Toggle pin for oscilloscope
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET); //start of the whole frequency sweep procedure
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET);
|
||||
|
||||
st = HAL_TIM_Base_Start_IT(&htim10);
|
||||
@ -393,8 +393,8 @@ int main(void)
|
||||
TO10 = 0;
|
||||
TIM10_coflag = 0;
|
||||
|
||||
//HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
|
||||
//HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_SET); // set the current step laser current trigger
|
||||
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_RESET);
|
||||
//*
|
||||
if (step_counter % trigger_step == 0){ //trigger at every 60 step
|
||||
OUT_trigger(trigger_counter);
|
||||
@ -402,7 +402,7 @@ int main(void)
|
||||
}
|
||||
++step_counter;
|
||||
//*/
|
||||
//*
|
||||
/*
|
||||
++task_sheduler;
|
||||
if (task_sheduler >= 10){
|
||||
task_sheduler = 0;
|
||||
@ -622,7 +622,7 @@ int main(void)
|
||||
if (task.tau > 3)
|
||||
{
|
||||
htim10.Init.Period = TIM10_period;
|
||||
TO10_counter = task.dt / 10 - 1;
|
||||
TO10_counter = task.dt / 10;
|
||||
}
|
||||
|
||||
CPU_state_old = RUN_TASK;
|
||||
@ -2077,7 +2077,7 @@ static void Decode_task(uint16_t *Command, LDx_SetupTypeDef *LD1_curr_setup, LDx
|
||||
task.p_coef_2 = (float)(*temp2) * 256.0; temp2++;
|
||||
task.i_coef_2 = (float)(*temp2) * 256.0; temp2++;
|
||||
|
||||
TO10_counter = task.dt / 10 - 1;
|
||||
TO10_counter = task.dt / 10;
|
||||
}
|
||||
|
||||
void OUT_trigger(uint8_t out_n)
|
||||
|
||||
@ -228,6 +228,8 @@ void ADC_IRQHandler(void)
|
||||
void TIM1_UP_TIM10_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN TIM1_UP_TIM10_IRQn 0 */
|
||||
//HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_SET); // set the current step laser current trigger
|
||||
//HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_RESET);
|
||||
TO10++;
|
||||
if (TO10 == TO10_counter)
|
||||
TIM10_coflag = 1;
|
||||
|
||||
Reference in New Issue
Block a user