Initialization

For basic operation, follow these steps:
  1. 1.Configure the desired input pins in the port peripheral as analog inputs.
  2. 2.Select the positive and negative input sources by writing to the Positive and Negative Input MUX Selection (MUXPOS and MUXNEG) bit fields in the MUX Control (ACn.MUXCTRL) register.
  3. 3.Optional: Enable the output to pin by writing a ‘1’ to the Output Pad Enable (OUTEN) bit in the Control A (ACn.CTRLA) register.
  4. 4.Enable the AC by writing a ‘1’ to the ENABLE bit in ACn.CTRLA.

During the start-up time after enabling the AC, the INITVAL bit in the CTRLB register can be used to set the AC output before the AC is ready. If VREF is used as a reference source, the respective start-up time of the reference source must be added. For details about the start-up time of the AC and VREF peripherals, refer to the Electrical Characteristics section.

To avoid the pin being tri-stated when the AC is disabled, the OUT pin must be configured as output.