Skip to main content
julien12657
Associate II
September 2, 2017
Question

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

  • September 2, 2017
  • 0 replies
  • 438 views
Posted on September 02, 2017 at 12:01

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;  

                }

}

    This topic has been closed for replies.