1.30.1 1.31.1 1.33.1 1.37.1 Analog Comparators (AC)
The Analog Comparator peripheral (AC) supports four individual comparators. Each comparator (COMP) compares the voltage levels on two inputs ('+' and '-' input pins of the comparator), and provides a digital output based on this comparison. Each comparator may be configured to generate interrupt requests and/or peripheral events upon several different combinations of input change.
The AC peripheral implements one pair of comparators. Each pair can be set in window mode to compare a signal to a voltage range instead of a single voltage level.
Using The Library
AC Peripheral library provides non-Blocking API's and they can be used to perform below functionalities on the AC peripheral.
-
Initialize the AC
-
Start comparison on a given comparator
-
Swap inputs of a comparator
-
Get status of a comparison operation
-
Register a callback
Library Interface
Analog Comparators peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
AC_Initialize | Initializes AC module of the device |
AC_Start | Triggers a comparator to start comparison |
AC_SwapInputs | Swap inputs of a comparator |
AC_ChannelSelect | Selects the positive and negative inputs of a channel |
AC_SetVddScalar | Sets VDDSCALER value of a comparator |
AC_StatusGet | Returns comparison status of the AC |
AC_CallbackRegister | Allows application to register callback with PLIB |
Data types and constants
Name | Type | Description |
---|---|---|
AC_CHANNEL | Enum | Identifies the AC output channel number |
AC_POSINPUT | Enum | Identifies the positive inputs of a comparator channel |
AC_NEGINPUT | Enum | Identifies negative inputs of a comparator channel |
AC_CALLBACK | Typedef | Analog comparator callback function pointer |