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...
 
enum adc_gain_factor gain_factor
 Gain factor. More...
 
bool left_adjust
 Left adjusted result. More...
 
enum adc_negative_input negative_input
 Negative MUX input. More...
 
struct adc_pin_scan_config pin_scan
 Pin scan configuration structure. More...
 
enum adc_positive_input positive_input
 Positive Multiplexer (MUX) input. 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
 Enables ADC in standby sleep mode if true. 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...
 
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.

Note: if the result width increases, result resolution will be changed accordingly.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_clock_prescaler adc_config::clock_prescaler
enum gclk_generator adc_config::clock_source
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.

if false, ADC will run in singled-ended mode.

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(), and adc_init().

bool adc_config::freerunning

Enables free running mode if true.

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

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.

For singled-ended conversion mode, the negative input must be connected to ground. This ground could be the internal GND, IOGND or an external ground connected to a pin.

Referenced by _adc_set_config(), adc_get_config_defaults(), run_adc_init_test(), setup_adc_average_mode_test(), and setup_adc_window_mode_test().

struct adc_pin_scan_config adc_config::pin_scan

Pin scan configuration structure.

Referenced by _adc_set_config(), and adc_get_config_defaults().

enum adc_positive_input adc_config::positive_input
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
bool adc_config::run_in_standby

Enables ADC in standby sleep mode if true.

Referenced by _adc_set_config(), and adc_get_config_defaults().

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().

struct adc_window_config adc_config::window

Window monitor configuration structure.

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