2017-09-02 03:01 AM
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;
}
}