3.2 Example for ATmega328PB
The high performance ATmega328PB is selected in this example.
ATmega328PB is a megaAVR 8-bit RISC-based microcontroller with picoPower® technology. It combines an 8-channel 10-bit A/D converter and operates between 1.8 and 5.5 volts.
Also, ATmega328PB is the first AVR 8-bit MCU to feature the QTouch® Peripheral Touch Controller (PTC), which acquires signals in order to detect touch on either self- or mutual-capacitance sensors. It provides a faster and less complex capacitive touch implementation in any application, saving BOM cost.
By executing powerful instructions in a single clock cycle, the device achieves throughputs approaching 1 MIPS/MHz, balancing power consumption, and processing speed.
As shown in the figure above, the ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB. Optionally, the AVCC or an internal 1.1V reference voltage may be connected to the AREF pin by writing to the REFSn bits in the ADMUX Register. The internal voltage reference must be decoupled by an external capacitor at the AREF pin to improve the noise immunity.
The analog input channel is selected by writing to the MUX bits in the ADC Multiplexer Selection register ADMUX.MUX[3:0]. Any of the ADC input pins, as well as GND and a fixed bandgap voltage reference, can be selected as single ended inputs to the ADC.
The ADC generates a 10-bit result, which is presented in the ADC Data Registers, ADCH, and ADCL. By default, the result is presented right adjusted, but can optionally be presented left adjusted by setting the ADC Left Adjust Result bit ADMUX.ADLAR.
