Hello. I am a beginner and i am trying to use one of the ADCs on my stm32f103ze.I have been using the examples from keil, they are well written and understandable. The problem is, they dont have an example showing use of an ADC. I have read the example from the stm firmware library and they use a different way of of setting up things than the examples from keil so i understood nothing. Can anyone link me to an (understandable,keil-example-like) example describing setting up the adc, and receiving values from it?
"in a non-interrupt mode, I would use two functions, adc_init() to set up the basic parameters for the adc, and then adc_read() to read back a particular channel's adc results."
Potentially a adc_start() to start a conversion, so adc_read() can be called later and pick up the result without having to wait. But that depends on how much work the CPU has to do, and what conversion speed the ADC will have.
"Potentially a adc_start() to start a conversion, so adc_read() can be called later and pick up the result without having to wait. But that depends on how much work the CPU has to do, and what conversion speed the ADC will have."
agreed.
if you are concerned about concurrency, using an interrupt to automate adc and adc_read() to simply return the value of the adc.
either way, at a minimum, one will need to set up the adc (adc_init()) and then perform a conversion (adc_read()).