1

I am using STM32F103C8T6 ADC1 single channel continuous conversion mode to collect the ambient temperature, but I am not very clear about using the function HAL_ADC_Start (& hadc1) because the function is called once before the "while" loop of the main () program and the Call this function multiple times in the loop, will this affect the value collected by ADC1? Thanks for the answer

1 Answers1

2

If you use continuous conversion mode you don't need to call this function multiple times. Just call it once and the conversions will start and go on and on.

To get the results in your loop you can use HAL_ADC_PollForConversion(&hadc) or start the ADC with interrupts and get the result in the callback function.

jusaca
  • 8,749
  • 4
  • 36
  • 58
  • If I use single channel single mode conversion of ADC1, but I use HAL_ADC_Start (& hadc1) in the "while" loop, can this achieve the same effect as using single channel continuous conversion mode? What is the problem with this? – eehongzhijun Apr 30 '20 at 06:46
  • 1
    Yes, this works as well. There is not necessarily a problem with it, it just won't work with the same speed as the continuous mode, because the code for starting the ADC has to be run each time. But for slow measurements (like less than a few hundred conversions per second) it should not make any difference. – jusaca Apr 30 '20 at 06:49
  • Thank you for your answers! – eehongzhijun Apr 30 '20 at 06:50