This tutorial shows how to use various modes of the STM32 ADCs, including:
- Basic single-channel measurement
- Use of interrupts
- Multi-channel sequences
Before you begin, install VisualGDB 5.0 or later and ensure you are using the latest version of the STM32 BSP.
An ADC (Analog-to-Digital Converter) is a peripheral that allows measuring the voltage (between 0 and Vref) on a certain input of the microcontroller and converting it into a number between 0 and 2N-1 where N is the ADC resolution. The easiest way to experiment with an ADC is to connect it to a potentiometer – a mechanically adjustable resistor:If you connect one of the side terminals of the potentiometer to the GND pin on your board and the other one to the VCC pin, rotating the potentiometer knob will gradually change the voltage level (relative to ground) on the third pin between 0 and VDD, that should produce values from 0 to 4095 for a 12-bit ADC.