3.2.1 Analog-to-Digital Converter (ADC)
This device have two 12-bit High-Speed Successive Approximation Register (SAR) Analog-to-Digital Converter (ADC) cores that feature low conversion latency, high resolution and oversampling capabilities to improve performance in AC/DC and DC/DC power converters.
Using The Library
Each 12-bit ADC includes the following features:
• 12-bit Resolution
• Up to 40 Msps Conversion
• Up to 22 Analog Input Pins
• 20 Settings Channels. Each Channel:
– Supports Discrete Configuration
– Can be assigned to any analog input (I/O pin or internal signal)
– Can be set to a different sampling time
– Can be configured as single-ended or differential
– Conversion result can be formatted as unsigned or signed
– Conversion result can be left-aligned (fraction format)
– Has a separate 32-bit conversion result register
• All Channels Support Four Sampling Modes:
– Oversampling of multiple samples
– Integration of multiple samples
– Window (multiple samples are accumulated when the gate signal is active)
– Single Conversion
• All channels have a digital comparator to detect when the conversion result is less than, greater than, or in bounds or out of bounds for the configurable thresholds
• Channels 17, 18 and 19 have a second result accumulator which can be used for a filter implementation
• Band Gap Reference and Temperature Sensor Diode Inputs
Library Interface
ADC Controller peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
ADCx_Initialize | Initializes given instance of ADCx peripheral |
ADCx_Deinitialize | De-initializes given instance of ADCx peripheral |
ADCx_Enable | Enables the ADCx module |
ADCx_Disable | Disables the ADCx module |
ADCx_SoftwareTriggerEnable | Sets software common trigger |
ADCx_ChannelSoftwareTriggerEnable | Sets individual software trigger |
ADCx_ChannelResultGet | Returns the conversion value for the channel selected |
ADCx_ChannelResultIsReady | Returns the status of conversion and determine if conversion is completed |
ADCx_ChannelResultInterruptEnable | Enables individual channel interrupt |
ADCx_ChannelResultInterruptDisable | Disables individual channel interrupt |
ADCx_ChannelResultFlagClear | Clears individual channel interrupt flag |
ADCx_CompareStatusGet | Returns the status of the comparator |
ADCx_IndividualChannelInterruptPrioritySet | Allows selection of priority for individual channel interrupt |
ADCx_ChannelCallbackRegister | Define custom callback for ADCx Channel event |
ADCx_ComparatorCallbackRegister | Define custom callback for ADCx Comparator event |
ADCx_PWMTriggerSourceSet | Sets Trigger source as PWM Trigger |
Data types and constants
Name | Type | Description |
---|---|---|
ADCx_CHANNEL | Enum |
Defines the ADC channels that are selected |
ADCx_PWM_INSTANCE | Enum | Defines the ADC PWM trigger sources that are available for the module to use |
INTERRUPT_PRIORITY | Enum |
Defines the interrupt priority values |
ADC_CHANNEL_CALLBACK | Typedef | Callback function prototype for ADC Channel conversion complete interrupt |
ADC_CMP_CALLBACK | Typedef | Callback function prototype for ADC Comparator event |
ADC_PWM_TRIGGERS | Enum | Defines the PWM triggers that are available in each individual PWM |