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

NameDescription
ADCx_InitializeInitializes given instance of ADCx peripheral
ADCx_DeinitializeDe-initializes given instance of ADCx peripheral
ADCx_EnableEnables the ADCx module
ADCx_DisableDisables the ADCx module
ADCx_SoftwareTriggerEnableSets software common trigger
ADCx_ChannelSoftwareTriggerEnableSets individual software trigger
ADCx_ChannelResultGetReturns the conversion value for the channel selected
ADCx_ChannelResultIsReadyReturns the status of conversion and determine if conversion is completed
ADCx_ChannelResultInterruptEnableEnables individual channel interrupt
ADCx_ChannelResultInterruptDisableDisables individual channel interrupt
ADCx_ChannelResultFlagClearClears individual channel interrupt flag
ADCx_CompareStatusGetReturns the status of the comparator
ADCx_IndividualChannelInterruptPrioritySetAllows selection of priority for individual channel interrupt
ADCx_ChannelCallbackRegisterDefine custom callback for ADCx Channel event
ADCx_ComparatorCallbackRegisterDefine custom callback for ADCx Comparator event
ADCx_PWMTriggerSourceSetSets Trigger source as PWM Trigger

Data types and constants

NameTypeDescription
ADCx_CHANNELEnum

Defines the ADC channels that are selected

ADCx_PWM_INSTANCEEnumDefines the ADC PWM trigger sources that are available for the module to use
INTERRUPT_PRIORITYEnum

Defines the interrupt priority values

ADC_CHANNEL_CALLBACKTypedefCallback function prototype for ADC Channel conversion complete interrupt
ADC_CMP_CALLBACKTypedefCallback function prototype for ADC Comparator event
ADC_PWM_TRIGGERSEnumDefines the PWM triggers that are available in each individual PWM