Author: Victor Berzan, Microchip Technology Inc. |
The Analog-to-Digital Converter (ADC) peripheral converts an analog voltage to a numerical value. This peripheral is included in many AVR® microcontrollers (MCUs). A 10-bit single-ended ADC peripheral is available on most of the tinyAVR® and megaAVR® MCUs.
Initialize the ADC, start conversion, wait until the conversion is done, read ADC result.
Initialize the ADC, enable Free Running mode, start conversion, wait until the conversion is done and read the ADC result in an infinite loop.
Initialize the ADC, enable accumulation of 64 samples, start conversion, wait until the conversion is done and read ADC result in a loop.
Initialize the ADC, set the conversion window comparator low threshold, enable the conversion Window mode, enable the Free Running mode, start the conversion, wait until the conversion is done and read the ADC result in an infinite loop, and light-up an LED if the ADC result is below the set threshold.
Initialize the ADC, initialize the Real Time Counter (RTC), configure the Event System (EVSYS) to trigger an ADC conversion on RTC overflow, toggle an LED after each ADC conversion.