36.4.3.2 Voltage Reference Selection

For each comparator, the reference voltage scaler generates a voltage (VREFSCALE) available as an input, based on the following formula:

V REFSCALE = V R E F × V A L U E 2 SIZE_REFSCALE

where VREF is the reference voltage for the comparator, VALUE is the scaling factor for the comparator, and SIZE_REFSCALE = 8.

As shown in the following figure, the reference voltage (VREF) is selected by writing to the Reference Selection bit field in the Comparator n Comparator Control B register (COMP[n].COMPCTRLB.REFSEL), and may be chosen from VDD, internal voltage references (INTVREF), or an external reference pin (EXTVREF). The internal reference option is configured by writing to the Internal Reference Selection bit field in the Control B register (CTRLB.INTREF). The reference voltages, except for VDD and EXTVREF, are generated from an internal band gap reference.

The scaling factor (VALUE) is configured by writing to the Scaled Reference Voltage bit field in the Comparator n Comparator Scaler register (COMP[n].COMPSCALER.VALUE).

Note: After selecting a new voltage reference, COMPn requires time to settle. Refer to the Electrical Characteristics section for more details.
Figure 36-2. Voltage Reference Selection