Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Introducing to STM32 ADC programming. Part2

After we had a quick overview of STM32 ADC peripheral, we can start digging deeper into specifics. To understand simple things lets go with the simplest case – single conversion mode. In this mode, ADC does one conversion and then stops. After ADC conversion result is stored into 16-bit ADC_DR data register (remember that conversion result is 12-bit), then End of Conversion (EOC) flag is set an interrupt is generated if EOCIE flag is set. The same situation is if the injected channel is converted. The difference is that the result is stored into corresponding ADC_DRJx register, JEOC flag is set and interrupt generated if JEOCIE flag is set. In our example, we are going to measure the internal temperature sensor value and send it using USART. A temperature sensor… Continue reading