In this lesson, you will learn how to select and configure the voltage reference source to define the measurement boundaries of your Analog-to-Digital Converter (ADC).
Defining the ADC Measurement Range
The ADC acts as a ruler, measuring an analog voltage and mapping it to a digital value. The "ruler" needs a fixed reference point, known as the Voltage Reference (). This reference defines the Full Scale Range (FSR) discussed in previous units. If your is 3.3V, a digital reading of "maximum" corresponds exactly to 3.3V. If your reference fluctuates, your digital readings will become inaccurate, even if your ADC hardware is perfect.
Internal vs. External References
You typically have two choices when configuring the ADC peripheral:
- Internal Reference ( or Bandgap): Most microcontrollers allow you to use the supply voltage () as the reference. While convenient, this is often "noisy" because the digital circuitry on the chip creates fluctuations on the power rail. High-precision designs often use an internal bandgap reference, which provides a stable, constant voltage (like 1.2V) regardless of power supply noise.
- External Reference (): For critical measurement accuracy, you connect a dedicated, high-precision voltage reference chip to a specific pin on your microcontroller. This bypasses the noisy power rails of the CPU, providing a rock-solid boundary for your conversions.
Implementation Logic
When configuring your ADC, you must explicitly tell the peripheral which source to use. In a typical embedded environment, this is done via a control register:
// Example: Configuring the ADC reference to an external source
void configure_adc_reference() {
// Clear existing reference bits and set to external VREF+ pin
ADC_CTRL_REG &= ~ADC_REF_MASK;
ADC_CTRL_REG |= ADC_REF_EXTERNAL_PIN;
// Enable the ADC peripheral after configuration
ADC_ENABLE = 1;
}
By choosing an external source, you decouple your measurement accuracy from the stability of your power supply, ensuring that the quantization steps remain consistent across different operating temperatures and power loads. Always check your datasheet to see if the chosen reference voltage range is compatible with your ADC’s input limits to avoid hardware damage.
Key Takeaway: The voltage reference defines the ceiling of your ADC measurement, so choosing between an internal bandgap or a high-precision external reference is the primary step in ensuring your digital data accurately represents the physical analog signal.