Microchip® Advanced Software Framework

ADC configuration structure.

Configuration structure for an ADC instance. This structure should be initialized by the adc_get_config_defaults() function before being modified by the user application.

#include <adc_feature.h>

Data Fields

enum adc_accumulate_samples accumulate_samples
 Number of ADC samples to accumulate when using the ADC_RESOLUTION_CUSTOM mode. More...
 
enum adc_clock_prescaler clock_prescaler
 Clock prescaler. More...
 
enum gclk_generator clock_source
 GCLK generator used to clock the peripheral. More...
 
struct adc_correction_config correction
 Gain and offset correction configuration structure. More...
 
bool differential_mode
 Enables differential mode if true. More...
 
enum adc_divide_result divide_result
 Division ration when using the ADC_RESOLUTION_CUSTOM mode. More...
 
enum adc_event_action event_action
 Event action to take on incoming event. More...
 
bool freerunning
 Enables free running mode if true. More...
 
bool left_adjust
 Left adjusted result. More...
 
enum adc_negative_input negative_input
 Negative MUX input. More...
 
bool on_demand
 ADC On demand control. More...
 
enum adc_positive_input positive_input
 Positive MUX input. More...
 
uint32_t positive_input_sequence_mask_enable
 Positive input enabled mask for conversion sequence. More...
 
enum adc_reference reference
 Voltage reference. More...
 
bool reference_compensation_enable
 Enables reference buffer offset compensation if true. More...
 
enum adc_resolution resolution
 Result resolution. More...
 
bool run_in_standby
 ADC run in standby control. More...
 
uint8_t sample_length
 This value (0-63) control the ADC sampling time in number of half ADC prescaled clock cycles (depends of ADC_PRESCALER value), thus controlling the ADC input impedance. More...
 
bool sampling_time_compensation_enable
 Enables sampling period offset compensation if true. More...
 
struct adc_window_config window
 Window monitor configuration structure. More...
 

enum adc_accumulate_samples adc_config::accumulate_samples

Number of ADC samples to accumulate when using the ADC_RESOLUTION_CUSTOM mode.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_clock_prescaler adc_config::clock_prescaler

Clock prescaler.

Referenced by _adc_set_config(), adc_get_config_defaults(), and configure_adc().

enum gclk_generator adc_config::clock_source

GCLK generator used to clock the peripheral.

Referenced by _adc_set_config(), adc_get_config_defaults(), and configure_adc().

struct adc_correction_config adc_config::correction

Gain and offset correction configuration structure.

Referenced by _adc_set_config(), and adc_get_config_defaults().

bool adc_config::differential_mode

Enables differential mode if true.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_divide_result adc_config::divide_result

Division ration when using the ADC_RESOLUTION_CUSTOM mode.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_event_action adc_config::event_action

Event action to take on incoming event.

Referenced by _adc_set_config(), adc_get_config_defaults(), adc_init(), and configure_adc().

bool adc_config::freerunning

Enables free running mode if true.

Referenced by _adc_set_config(), adc_get_config_defaults(), and adc_init().

bool adc_config::left_adjust

Left adjusted result.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_negative_input adc_config::negative_input

Negative MUX input.

Referenced by _adc_set_config(), and adc_get_config_defaults().

bool adc_config::on_demand

ADC On demand control.

Referenced by _adc_set_config(), adc_get_config_defaults(), and configure_adc().

enum adc_positive_input adc_config::positive_input

Positive MUX input.

Referenced by _adc_set_config(), and adc_get_config_defaults().

uint32_t adc_config::positive_input_sequence_mask_enable

Positive input enabled mask for conversion sequence.

The sequence start from the lowest input, and go to the next enabled input automatically when the conversion is done. If no bits are set the sequence is disabled.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_reference adc_config::reference

Voltage reference.

Referenced by _adc_set_config(), adc_get_config_defaults(), adc_init(), and configure_adc().

bool adc_config::reference_compensation_enable

Enables reference buffer offset compensation if true.

This will increase the accuracy of the gain stage, but decreases the input impedance; therefore the startup time of the reference must be increased.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_resolution adc_config::resolution

Result resolution.

Referenced by _adc_set_config(), adc_get_config_defaults(), and configure_adc().

bool adc_config::run_in_standby

ADC run in standby control.

Referenced by _adc_set_config(), adc_get_config_defaults(), and configure_adc().

uint8_t adc_config::sample_length

This value (0-63) control the ADC sampling time in number of half ADC prescaled clock cycles (depends of ADC_PRESCALER value), thus controlling the ADC input impedance.

Sampling time is set according to the formula: Sample time = (sample_length+1) * (ADCclk / 2).

Referenced by _adc_set_config(), and adc_get_config_defaults().

bool adc_config::sampling_time_compensation_enable

Enables sampling period offset compensation if true.

Referenced by _adc_set_config(), and adc_get_config_defaults().

struct adc_window_config adc_config::window

Window monitor configuration structure.

Referenced by _adc_set_config(), and adc_get_config_defaults().