Microchip® Advanced Software Framework

adc_configure.c File Reference

ADC Features Configuration file.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "conf_example.h"
#include "adc_configure.h"

Functions

void adc_correction_start (void)
 ADC Offset and Gain mode configuration. More...
 
void adc_correction_stop (void)
 ADC Offset and Gain mode configuration. More...
 
void configure_adc (void)
 ADC Configuration normal mode. More...
 
void configure_adc_averaging (void)
 ADC Averaging mode configuration. More...
 
void configure_adc_differential (void)
 ADC Differential mode configuration. More...
 
void configure_adc_sampling (void)
 ADC Oversampling mode configuration. More...
 
void configure_adc_window_monitor (void)
 ADC Window Monitoring mode configuration. More...
 

Variables

struct adc_module adc_instance
 Support and FAQ: visit Microchip Support More...
 
static bool correction_measures_done = false
 

void adc_correction_start ( void  )

ADC Offset and Gain mode configuration.

This function starts the ADC correction using offset calibration and gain calibration

GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND

References ADC_CALIBRATION_IN_VOLTAGE, ADC_CALIBRATION_REF_VOLTAGE, adc_enable(), adc_get_config_defaults(), adc_init(), adc_instance, adc_start_read_result(), correction_measures_done, and printf.

Referenced by adc_calibration().

void adc_correction_stop ( void  )

ADC Offset and Gain mode configuration.

This function disable the ADC correction for offset calibration and gain calibration

References adc_enable(), adc_get_config_defaults(), adc_init(), adc_instance, and correction_measures_done.

Referenced by adc_calibration().

void configure_adc ( void  )

ADC Configuration normal mode.

[setup] [configure_adc]

This function configures ADC as normal mode with below Settings

GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND

[setup_adc_config]

[setup_adc_config]

[setup_adc_config_defaults]

[setup_adc_config_defaults]

[setup_adc_config_extra]

[setup_adc_config_extra]

[setup_adc_set_config]

[setup_adc_set_config]

[setup_adc_enable]

[setup_adc_enable]

[setup_config]

[setup_config] [setup_config_defaults]

[setup_config_defaults]

[setup_set_config]

[setup_set_config]

[setup_enable]

[setup_enable]

[setup_config]

[setup_config] [setup_config_defaults]

[setup_config_defaults]

[setup_modify_conf]

[setup_modify_conf]

[setup_set_config]

[setup_set_config]

[setup_enable]

[setup_enable]

References adc_enable(), adc_get_config_defaults(), adc_init(), adc_instance, and GCLK_GENERATOR_1.

void configure_adc_averaging ( void  )

ADC Averaging mode configuration.

This function configures ADC as Averaging mode with below Settings

GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND SAMPLES -> 1024 RESULT_DIV -> 16

References adc_enable(), adc_get_config_defaults(), adc_init(), adc_instance, and GCLK_GENERATOR_1.

Referenced by adc_hardware_averaging().

void configure_adc_differential ( void  )

ADC Differential mode configuration.

This function configures ADC as differential mode with below Settings

GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> PA04

References adc_enable(), adc_get_config_defaults(), adc_init(), adc_instance, and GCLK_GENERATOR_1.

Referenced by adc_differential().

void configure_adc_sampling ( void  )

ADC Oversampling mode configuration.

This function configures ADC as Oversampling mode with below Settings

GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) RESOLUTION -> 16 bit POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND

References adc_enable(), adc_get_config_defaults(), adc_init(), adc_instance, and GCLK_GENERATOR_1.

Referenced by adc_oversampling().

void configure_adc_window_monitor ( void  )

ADC Window Monitoring mode configuration.

This function configures ADC as Window Monitoring mode with below Settings

GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND Threshold low level -> 0.75V Monitor mode -> Above lower threshold

References adc_enable(), adc_get_config_defaults(), adc_init(), adc_instance, and GCLK_GENERATOR_1.

Referenced by adc_window_monitor().

struct adc_module adc_instance

Support and FAQ: visit Microchip Support

Support and FAQ: visit Microchip Support

Support and FAQ: visit Microchip Support

[adc_module_inst]

Support and FAQ: visit Microchip Support

[module_inst]

bool correction_measures_done = false
static