2.2 Analog Comparator Controller (ACC)

The Analog Comparator Controller (ACC) configures the analog comparator and generates an interrupt depending on user settings. The analog comparator embeds two 8-to-1 multiplexers that generate two internal inputs. These inputs are compared, resulting in a compare output. The hysteresis level, edge detection and polarity are configurable. The ACC also generates a compare event which can be used by the Pulse Width Modulator (PWM).

Using The Library

The analog comparison status can be polled by the software or can be configured to generate a callback.

  • With polling, the application will need to continuously poll to check if the comparison edge occurred

  • With Callback, the registered callback function will be called when comparison edge is detected. This means the application do not have to poll continuously.

Library Interface

Analog Comparator Controller peripheral library provides the following interfaces:

Functions

NameDescription
ACC_InitializeInitializes ACC module of the device
ACC_EnableEnables ACC peripheral
ACC_DisableEnables ACC peripheral
ACC_StatusGetReturns comparison status of the ACC
ACC_RegisterCallbackAllows application to register callback with PLIB
ACC_CallbackRegisterAllows application to register callback with PLIB

Data types and constants

NameTypeDescription
ACC_STATUS_SOURCEEnumIdentifies ACC Comparison status
ACC_CALLBACKTypedefACC Callback function pointer
ACC_CALLBACKTypedefACC callback function pointer
Note: Not all APIs maybe implemented. See the specific device family section for available APIs.