23.5.2 ADC Voltage ReferenceThe reference voltage for the ADC (VREF) indicates the conversion range for the ADC. Singleended channels that exceed VREF will result in codes close to 0x3FF. VREF can be selected aseither AVCC, internal 1.1V reference, or external AREF pin.AVCC is connected to the ADC through a passive switch. The internal 1.1V reference is generatedfrom the internal bandgap reference (VBG) through an internal amplifier. In either case, theexternal AREF pin is directly connected to the ADC, and the reference voltage can be mademore immune to noise by connecting a capacitor between the AREF pin and ground. VREF canalso be measured at the AREF pin with a high impedance voltmeter. Note that VREF is a highimpedance source, and only a capacitive load should be connected in a system.If the user has a fixed voltage source connected to the AREF pin, the user may not use the otherreference voltage options in the application, as they will be shorted to the external voltage. If noexternal voltage is applied to the AREF pin, the user may switch between AVCC and 1.1V as referenceselection. The first ADC conversion result after switching reference voltage source maybe inaccurate, and the user is advised to discard this result.
// set a2d reference to AVCC (5 volts) cbi(ADMUX, REFS1); [glow]s[/glow]bi(ADMUX, REFS0);
// set a2d reference to AREF cbi(ADMUX, REFS1); [glow]c[/glow]bi(ADMUX, REFS0);