2.3 Analog Digital Converter (ADC)
This Plib implements software abstraction for ADC Peripheral.
Library Interface
Analog Digital Converter peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
ADCx_Initialize | Initializes ADC peripheral |
ADCx_Enable | Enable (turn ON) ADC module |
ADCx_Disable | Disable ADC module |
ADC_SamplingStart | Starts the sampling |
ADCx_ChannelSelect | Selects ADC input channel |
ADCx_ConversionStart | Starts the ADC conversion of all the enabled channels with the software trigger |
ADCx_ConversionStatusGet | Returns the status of the conversion of the channel |
ADCx_ConversionResultGet | Returns the conversion result of the channel |
ADCx_LastConversionResultGet | Returns the result for the previous adc conversion of the channel |
ADCx_ConversionSequenceIsFinished | Returns the status of automatic sequence conversion |
ADCx_ComparisonWindowSet | Returns the status of automatic sequence conversion |
ADCx_WindowMonitorStatusGet | Returns the status of the window monitor flag |
ADCx_ComparisonWindowSet | Returns the status of automatic sequence conversion |
ADCx_WindowModeSet | This function configures the window comparison mode |
ADCx_InterruptsClear | This function clears the interrupt flags |
ADCx_InterruptsEnable | This function enables the interrupts |
ADCx_InterruptsDisable | This function disables the interrupts |
ADCx_CallbackRegister | Registers the function to be called from interrupt |
ADC_InputSelect | Selects input for ADC |
ADC_InputScanSelect | Selects input for scanning ADC channels |
ADC_ResultIsReady | Returns the status of the channel conversion |
ADC_ResultGet | Provides the ADC conversion result based on the buffer index |
ADC_CompareEnable | Enables digital comparisons for the given channel on the specified ADC core |
ADC_CompareDisable | Disables digital comparisons for the given channel on the specified ADC core |
ADC_CompareWinThresholdSet | Configures the low and high threshold values for the comparator on the specified ADC core |
ADC_CompareWinModeSet | Configures the low and high threshold values for the comparator on the specified ADC core |
ADC_GlobalInterruptsStatusGet | Returns the global interrupt status |
ADC_CoreInterruptsEnable | Enables the specified ADC core's interrupt |
ADC_CoreInterruptsDisable | Disable the specified ADC core's interrupts |
ADC_CoreInterruptsStatusGet | Returns the specified ADC core's interrupt status |
ADC_CoreInterruptsStatusClear | Clears the specified ADC core's interrupt status |
ADC_GlobalEdgeConversionStart | Generates global edge trigger and starts conversion on channels configured with Global edge as the trigger source |
ADC_GlobalLevelConversionStart | Starts global level trigger and starts conversion on channels configured with Global level as the trigger source |
ADC_GlobalLevelConversionStop | Stops global level trigger and stops conversion on channels configured with Global level as the trigger source |
ADC_SyncTriggerEnable | Enables sync trigger defined by CTRLC.CNT value |
ADC_SyncTriggerDisable | Disables sync trigger |
ADC_SyncTriggerCounterSet | Configures the value of CTRLC.CNT register |
ADC_SoftwareControlledConversionEnable | Enables software controlled conversion on the specified ADC core's channel |
ADC_ChannelsEnable | Enables the ADC channels |
ADC_ChannelsDisable | Disables the ADC channels |
ADC_ChannelsInterruptEnable | Enables the ADC interrupt sources |
ADC_ChannelsInterruptDisable | Disables the ADC interrupt sources |
ADC_InterruptEnable | This function enables the interrupts |
ADC_InterruptDisable | This function disables the interrupts |
ADC_InterruptStatusGet | Returns the status of ADC interrupt |
ADC_ChannelSamplingStart | Enables the Analog Mux Input and starts sampling on the ADC core and channel that was specified using the ADC_SoftwareControlledConversionEnable() API |
ADC_ChannelSamplingStop | Stops sampling on the ADC core and channel that was specified using the ADC_SoftwareControlledConversionEnable() API |
ADC_ChannelConversionStart | Starts conversion on the ADC core and channel that was specified using the ADC_SoftwareControlledConversionEnable() API |
ADC_ChannelResultIsReady | Returns the status of the channel conversion |
ADC_ChannelResultGet | Reads the conversion result of the channel |
ADC_EOSStatusGet | Indicates whether End of scan interrupt flag is set on the specified ADC core |
ADC_ResultGet | Returns the ADC conversion value for the specified ADC core channel |
ADC_FIFORead | Returns a single ADC conversion value from the ADC FIFO |
ADC_FIFOBufferRead | Returns multiple ADC conversion values from the ADC FIFO |
ADC_GlobalCallbackRegister | Registers the global callback function |
ADC_COREnCallbackRegister | Registers the ADC core specific callback function |
ADC_ConversionSequenceSet | Sets the user sequence of the channel conversion |
ADCx_ComparisonWindowSet | Sets Low threshold and High threshold in comparison window |
ADC_ComparisonEventResultIsReady | Returns the status of the Comparison event |
ADC_ComparisonRestart | Restart the comparison function |
ADC_SleepModeEnable | This function enables ADC sleep mode |
ADC_SleepModeDisable | This function disables ADC sleep mode |
ADC_FastWakeupEnable | This function enables ADC Fast Wakeup |
ADC_FastWakeupDisable | This function disables ADC Fast Wakeup |
Data types and constants
Name | Type | Description |
---|---|---|
ADC_MUX | Enum | Identifies which ADC Mux is to be configured |
ADC_RESULT_BUFFER | Enum | Identifies which ADC buffer has to be read |
ADC_INPUT_POSITIVE | Enum | Identifies possible positive input for ADC |
ADC_INPUT_NEGATIVE | Enum | Identifies possible negative input for ADC |
ADC_INPUTS_SCAN | Enum | Identifies possible ADC inputs which can be scanned |
ADC_STATUS | Enum | Identifies ADC interrupt flag status |
ADC_POSINPUT | Enum | Identifies ADC positive input pin to select |
ADC_NEGINPUT | Enum | Identifies ADC negative input pin to select |
ADC_WINMODE | Enum | Identifies ADC window comparison modes |
ADC_CALLBACK | Typedef | Defines the data type and function signature for the ADC peripheral callback function |
ADC_CALLBACK_OBJECT | Struct | ADC Callback structure |
ADC_CORE_INT_CMPHIT | Macro | Identifies ADC core interrupt status |
ADC_FIFO_CORID_GET | Macro | Returns the ADC core id in the ADC FIFO data |
ADC_FIFO_DATA_GET | Macro | Returns the ADC conversion resunt from the ADC FIFO data |
ADC_FIFO_CHNID_GET | Macro | Returns the ADC channel id in the ADC FIFO data |
ADC_FIFO_CNT_GET | Macro | Returns the current number of entries present in the ADC FIFO |
ADC_GLOBAL_INT_CRRDY1 | Macro | Identifies ADC global interrupt status |
ADC_CHANNEL_MASK | Enum | Identifies ADC channel mask |
ADC_CHANNEL_NUM | Enum | Identifies ADC channel number |
ADC_INTERRUPT_EOC_MASK | Enum | Identifies EOC interrupt sources number |
ADC_INTERRUPT_MASK | Enum | Identifies interrupt sources number |
ADC_CORE_NUM | Enum | Identifies ADC core |
ADC_CORE_CALLBACK | Typedef | Defines the function pointer data type and function signature for the adc peripheral core callback function |
ADC_GLOBAL_CALLBACK | Typedef | Defines the function pointer data type and function signature for the adc peripheral global callback function |
ADC_CORE_CALLBACK_OBJECT | Struct | ADC Core events Callback structure |
ADC_GLOBAL_CALLBACK_OBJECT | Struct | ADC Global Callback structure |
Note: Not all APIs maybe implemented. See the specific device family
section for available APIs.