Bar Logo 4kW dsPIC33C PSFB DC-DC DA (Part-No. )
 
Content
     
Loading...
Searching...
No Matches
MCC Custom Code ADC

Contain functions and data types as MCC extension for ADC. More...

+ Collaboration diagram for MCC Custom Code ADC:

Files

file  drv_custom_config_adc.h
 Contains ADC initialization that was not supported by MCC generated code.

 
file  drv_mcc_extension_adc.h
 Contains public functions and defines for the MCC code extension for ADC.

 

Enumerations

enum  ADC_FILTER_MODE_e { ADC_FILTER_MODE_OVERSAMPLING = 0 , ADC_FILTER_MODE_AVERAGING = 3 }
 ADC Filter Modes of operation. More...
 
enum  ADC_FILTER_OVRSAM_AVG_e { ADC_FILTER_OVRSAM_AVG_2x = 0 , ADC_FILTER_OVRSAM_AVG_4x = 1 , ADC_FILTER_OVRSAM_AVG_8x = 2 , ADC_FILTER_OVRSAM_AVG_16x = 3 , ADC_FILTER_OVRSAM_AVG_32x = 4 , ADC_FILTER_OVRSAM_AVG_64x = 5 , ADC_FILTER_OVRSAM_AVG_128x = 6 , ADC_FILTER_OVRSAM_AVG_256x = 7 }
 ADC Filter Oversampling Ratio when in averaging mode. More...
 

Functions

static __inline__ void DRV_Config_Custom_ADC (void)
 Customize configuration for ADC.
 
static void ADC_Filter_Enable (uint16_t filterIndex, bool enable)
 Enables the ADC filter feature of the ADC.
 
static void ADC_Filter_Mode (uint16_t filterIndex, ADC_FILTER_MODE_t mode)
 Sets the ADC instance filter mode.
 
static void ADC_Filter_Averaging (uint16_t filterIndex, ADC_FILTER_OVRSAM_AVG_t averagingRatio)
 Sets the ADC instance number of samples to average.
 
static void ADC_Filter_Input (uint16_t filterIndex, uint16_t channelIndex)
 Sets the ADC instance to be filtered.
 
static uint16_t ADC_Filter_GetResult (uint16_t filterIndex)
 Gets the ADC filter result.
 
#define ADC_CHANNEL_FB_VOUT   (2)
 ADC2 is routed to Output Voltage.
 
#define ADC_CHANNEL_FB_VCAP   (9)
 ADC9 is routed to Output Cap Voltage.
 
#define ADC_CHANNEL_VIN   (10)
 ADC10 is routed to Primary Voltage.
 
#define ADC_CHANNEL_TEMP   (14)
 ADC14 is routed to Temperature.
 
#define ADC_CHANNEL_AN15   (15)
 ADC15 is routed to AN15.
 
#define ADC_CHANNEL_VRAIL_5V   (19)
 ADC19 is routed to 5V rail.
 
#define ADC_CHANNEL_IPRI_CT   (0)
 ADC0 is routed to Primary CT Current.
 
#define ADC_CHANNEL_ISEC_AVG   (1)
 ADC1 is routed to Secondary Average Current.
 

Detailed Description

This documentation includes functions and data types for the ADC peripheral as an enhancement to the MCC Code Configurator. It provides application-specific ADC functions and includes essential ADC initialization that is not supported by the code generated by MCC.

Macro Definition Documentation

◆ ADC_CHANNEL_AN15

#define ADC_CHANNEL_AN15   (15)

Definition at line 23 of file drv_custom_config_adc.h.

◆ ADC_CHANNEL_FB_VCAP

#define ADC_CHANNEL_FB_VCAP   (9)

Definition at line 20 of file drv_custom_config_adc.h.

◆ ADC_CHANNEL_FB_VOUT

#define ADC_CHANNEL_FB_VOUT   (2)

Definition at line 19 of file drv_custom_config_adc.h.

◆ ADC_CHANNEL_IPRI_CT

#define ADC_CHANNEL_IPRI_CT   (0)

Definition at line 27 of file drv_custom_config_adc.h.

◆ ADC_CHANNEL_ISEC_AVG

#define ADC_CHANNEL_ISEC_AVG   (1)

Definition at line 28 of file drv_custom_config_adc.h.

◆ ADC_CHANNEL_TEMP

#define ADC_CHANNEL_TEMP   (14)

Definition at line 22 of file drv_custom_config_adc.h.

◆ ADC_CHANNEL_VIN

#define ADC_CHANNEL_VIN   (10)

Definition at line 21 of file drv_custom_config_adc.h.

◆ ADC_CHANNEL_VRAIL_5V

#define ADC_CHANNEL_VRAIL_5V   (19)

Definition at line 24 of file drv_custom_config_adc.h.

Enumeration Type Documentation

◆ ADC_FILTER_MODE_e


Enumerator
ADC_FILTER_MODE_OVERSAMPLING 
ADC_FILTER_MODE_AVERAGING 

Definition at line 19 of file drv_mcc_extension_adc.h.

◆ ADC_FILTER_OVRSAM_AVG_e


Enumerator
ADC_FILTER_OVRSAM_AVG_2x 
ADC_FILTER_OVRSAM_AVG_4x 
ADC_FILTER_OVRSAM_AVG_8x 
ADC_FILTER_OVRSAM_AVG_16x 
ADC_FILTER_OVRSAM_AVG_32x 
ADC_FILTER_OVRSAM_AVG_64x 
ADC_FILTER_OVRSAM_AVG_128x 
ADC_FILTER_OVRSAM_AVG_256x 

Definition at line 31 of file drv_mcc_extension_adc.h.

Function Documentation

◆ ADC_Filter_Averaging()

static void ADC_Filter_Averaging ( uint16_t filterIndex,
ADC_FILTER_OVRSAM_AVG_t averagingRatio )
inlinestatic


Parameters
filterIndexADC filter index (four indexes available for ADC filter)
averagingRatioPointer to a power control data object of type ADC_FILTER_OVRSAM_AVG_t
Returns
void

This function sets the number of samples to average in the particular ADC instance.

Definition at line 115 of file drv_mcc_extension_adc.h.

◆ ADC_Filter_Enable()

static void ADC_Filter_Enable ( uint16_t filterIndex,
bool enable )
inlinestatic


Parameters
filterIndexADC filter index (four indexes available for ADC filter)
enableADC filter enable
Returns
void

This function enables the ADC feature of the ADC instance.

Definition at line 53 of file drv_mcc_extension_adc.h.

◆ ADC_Filter_GetResult()

static uint16_t ADC_Filter_GetResult ( uint16_t filterIndex)
inlinestatic


Parameters
filterIndexADC filter index (four indexes available for ADC filter)
Returns
filterResult result of the filtered ADC

This function gives the value of the ADC filter output.

Definition at line 177 of file drv_mcc_extension_adc.h.

◆ ADC_Filter_Input()

static void ADC_Filter_Input ( uint16_t filterIndex,
uint16_t channelIndex )
inlinestatic


Parameters
filterIndexADC filter index (four indexes available for ADC filter)
channelIndexADC channel
Returns
void

This function sets up the ADC filter for the specific ADC instance.

Definition at line 145 of file drv_mcc_extension_adc.h.

◆ ADC_Filter_Mode()

static void ADC_Filter_Mode ( uint16_t filterIndex,
ADC_FILTER_MODE_t mode )
inlinestatic


Parameters
filterIndexADC filter index (four indexes available for ADC filter)
modePointer to a power control data object of type ADC_FILTER_MODE_t
Returns
void

This function set the ADC instance filter mode either OverSampling mode or Averaging mode.

Definition at line 84 of file drv_mcc_extension_adc.h.

◆ DRV_Config_Custom_ADC()

static __inline__ void DRV_Config_Custom_ADC ( void )
static
Returns
void

This function initializes the ADC module to use the ADC Filter mode (averaging mode) to some of the ADC being sampled in the application.

Definition at line 39 of file drv_custom_config_adc.h.