43.6.2.1 Comparator Configuration

Each individual comparator must be configured by its respective Comparator Control register (COMPCTRLn) before that comparator is enabled. These settings cannot be changed while the comparator is enabled.

  • Select the desired measurement mode with COMPCTRLn.SINGLE. See Starting a Comparison for more details.
  • Select the desired hysteresis with COMPCTRLn.HYSTEN and COMPCTRLn.HYST. See Input Hysteresis for more details.
  • Write COMPCTRLn.SPEED to ‘1’ (high speed)
  • Select the interrupt source with COMPCTRLn.INTSEL
  • Select the positive and negative input sources with the COMPCTRLn.MUXPOS and COMPCTRLn.MUXNEG bits. See Selecting Comparator Inputs for more details.
  • Select the filtering option with COMPCTRLn.FLEN
  • Select standby operation with Run in the Standby bit (COMPCTRLn.RUNSTDBY)

The individual comparators are enabled by writing a '1' to the Enable bit in the Comparator x Control registers (COMPCTRLn.ENABLE). The individual comparators are disabled by writing a '0' to COMPCTRLn.ENABLE. Writing a '0' to CTRLA.ENABLE will also disable all the comparators, but will not clear their COMPCTRLn.ENABLE bits.