CUBEMx中STM32,DAC没有输出值,始终0.062V,但是直接赋值2048有1.66输出
HAL库很是抓狂,代码如下:
while (1)
{
uint32_t i=0;
uint32_t Data=0;
for(i=0;i<=5;i++)
{
Data=i*500;
HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_R, Data );
HAL_DAC_Start(&hdac, DAC_CHANNEL_1);
HAL_DAC_SetValue(&hdac, DAC_CHANNEL_2, DAC_ALIGN_12B_R, Data );
HAL_DAC_Start(&hdac, DAC_CHANNEL_2);
printf ("a=%f v
",3.3*(Data/4095));
HAL_Delay(1000);
HAL_Delay(1000);
HAL_Delay(1000);
HAL_Delay(1000);
HAL_Delay(1000);
}
}
一周热门 更多>