AnsweredAssumed Answered

When I want to output un sinewave which the points are included in the exc[z] array it is way slower if I use a timer interrupt : while(1)      {           HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_0); //7 µS to send one point   HAL_DAC_SetValue(&hdac,DAC_CHANNEL_1,DAC_A

Question asked by julien vaillant on Sep 2, 2017

When I want to output un sinewave which the points are included in the exc[z] array it is way slower if I use a timer interrupt :

 

while(1)      {       

 HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_0); / / 7 µS to send one point checked on oscilloscope  HAL_DAC_SetValue(&hdac,DAC_CHANNEL_1,DAC_ALIGN_12B_R,exc[i]);       

 i++;       

 if(i==z)i=0;      }    

 

and

 

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

{   

           if(htim->Instance == TIM2)

                   { HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_0); //32 µS to send one point checked on oscilloscope

                    HAL_DAC_SetValue(&hdac,DAC_CHANNEL_1,DAC_ALIGN_12B_R,exc[i]);

                    i++;   

                   if(i==z)i=0;  

                }

}

Outcomes