3.2.2 ADC with Computation
8-bit, 10-bit, and 12-bit Analog-to-Digital Converters with Computation features
3.2.2.1 Introduction
The Analog-to-Digital Converter (ADC) module can be a 8-bit, 10-bit or 12-bit ADC depending on the device used. This ADC can have computation features such as Successive Approximation Registers (SAR), Burst Accumulation and/or Programmable Gain Amplifiers. It can be operated in single-ended or differential conversion mode. The ADC input channels are also configurable to use internal peripheral outputs or external analog input pins.
3.2.2.2 Supported Device Families
AVR® Dx | ATtiny | ATmega16xx | ATmega48xx |
AVR®EA | ATmega80x | ATmega88xx |
3.2.2.3 Required header files:
#include "mcc_generated_files/adc/adc[X].h"
3.2.2.4 Module Documentation
3.2.2.4.1 Analog-to-Digital Converter (ADC0)
This file contains the API prototypes and data types for the ADC0 driver.
Module description
This file contains the API prototypes and data types for the ADC0 driver.
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
void ADC0_ConversionDoneInterruptEnable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 1.
void ADC0_ConversionDoneInterruptDisable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 0.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
void ADC0_ThresholdInterruptEnable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 1.
void ADC0_ThresholdInterruptDisable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 0.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
void ADC0_Tasks (void)
Implements the Tasks routine for the polling implementation.
void ADC0_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion.
adc_result_t ADC0_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of one conversion on the selected channel.
Function Documentation
ADC0_AccumulatedResultGet()
adc_accumulate_t ADC0_AccumulatedResultGet (void )
Retrieves the value of the accumulated conversions.
None. |
adc_accumulate_t - The value of accumulated conversions |
ADC0_AutoTriggerDisable()
void ADC0_AutoTriggerDisable (void )
Sets the Start Event Input (STARTEI) bit to 0.
None. |
None. |
ADC0_AutoTriggerEnable()
void ADC0_AutoTriggerEnable (void )
Sets the Start Event Input (STARTEI) bit to 1.
None. |
None. |
ADC0_ChannelSelect()
void ADC0_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion.
channel |
Desired analog channel. Refer to the adc_channel_t enum for the list of available analog channels. |
None. |
ADC0_ChannelSelectAndConvert()
adc_result_t ADC0_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of one conversion on the selected channel.
channel |
Desired analog channel. Refer to the adc_channel_t enum for the list of available analog channels. |
adc_result_t - The result of the conversion |
ADC0_ComputationModeSet()
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
computationMode |
Desired computation mode. Refer to the adc_computation_mode_t enum for the list of available computation modes. |
None. |
ADC0_ContinuousConversionDisable()
void ADC0_ContinuousConversionDisable (void )
Sets the Free-Running (FREERUN) bit to 0.
None. |
None. |
ADC0_ContinuousConversionEnable()
void ADC0_ContinuousConversionEnable (void )
Sets the Free-Running (FREERUN) bit to 1.
None. |
None. |
ADC0_ConversionDoneCallbackRegister()
void ADC0_ConversionDoneCallbackRegister (void(*)(void) callback)
Sets the callback function for the Result Ready Interrupt (RESRDY).
*callback |
The pointer to the function to be executed |
None. |
ADC0_ConversionDoneInterruptDisable()
void ADC0_ConversionDoneInterruptDisable (void )
Sets the Result Ready Interrupt Enable (RESRDY) bit to 0.
None. |
None. |
ADC0_ConversionDoneInterruptEnable()
void ADC0_ConversionDoneInterruptEnable (void )
Sets the Result Ready Interrupt Enable (RESRDY) bit to 1.
None. |
None. |
ADC0_ConversionDoneInterruptFlagClear()
void ADC0_ConversionDoneInterruptFlagClear (void )
Clears the Result Ready Interrupt (RESRDY) flag.
None. |
None. |
ADC0_ConversionResultGet()
adc_result_t ADC0_ConversionResultGet (void )
Retrieves the result of the latest conversion.
None. |
adc_result_t - The result of the conversion |
ADC0_ConversionStart()
void ADC0_ConversionStart (void )
Starts the ADC conversion on the selected channels.
Starts the ADC conversion on a selected channel.
Select the channel using ADC0_DifferentialChannelSelect and call ADC0_Initialize(void) to initialize the ADC module before using this API. |
None. |
Select the channel using ADC0_ChannelSelect and call ADC0_Initialize(void) to initialize the ADC module before using this API. |
None. |
ADC0_ConversionStop()
void ADC0_ConversionStop (void )
Stops the ongoing ADC conversion.
None. |
None. |
ADC0_Deinitialize()
void ADC0_Deinitialize (void )
Deinitializes the registers to Power-on Reset values.
None. |
None. |
ADC0_DifferentialChannelSelect()
void ADC0_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion.
posChannel |
Desired positive analog channel. Refer to the adc_posChannel_t enum for the list of available analog channels. |
negChannel |
Desired negative analog channel. Refer to the adc_negChannel_t enum for the list of available analog channels. |
None. |
ADC0_DifferentialChannelSelectAndConvert()
adc_result_t ADC0_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels.
posChannel |
Desired positive analog channel. Refer to the adc_posChannel_t enum for the list of available analog channels. |
negChannel |
Desired negative analog channel. Refer to the adc_negChannel_t enum for the list of available analog channels. |
adc_result_t - The result of the conversion |
ADC0_Disable()
void ADC0_Disable (void )
Sets the ADC Enable bit to 0.
None. |
None. |
ADC0_Enable()
void ADC0_Enable (void )
Sets the ADC Enable bit to 1.
None. |
None. |
ADC0_Initialize()
void ADC0_Initialize (void )
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
None. |
None. |
ADC0_IsConversionDone()
bool ADC0_IsConversionDone (void )
Checks if the ongoing ADC conversion is complete.
None. |
True |
- The conversion is complete |
False |
- The conversion is ongoing |
ADC0_IsConversionDoneInterruptFlagSet()
bool ADC0_IsConversionDoneInterruptFlagSet (void )
Checks the Result Ready Interrupt (RESRDY) flag status.
None. |
True |
- RESRDY flag is set |
False |
- RESRDY flag is not set |
ADC0_IsThresholdInterruptFlagSet()
bool ADC0_IsThresholdInterruptFlagSet (void )
Checks the Window Comparator Interrupt (WCMP) flag status.
None. |
True |
- WCMP flag is set |
False |
- WCMP flag is not set |
ADC0_LowerThresholdSet()
void ADC0_LowerThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
lowerThreshold |
Lower threshold value of the adc_threshold_t type |
None. |
ADC0_ResolutionGet()
uint8_t ADC0_ResolutionGet (void )
Returns the resolution of the ADC module.
None. |
uint8_t - Resolution value |
ADC0_SampleRepeatCountSet()
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
repeatCount |
Repeat count value. Refer to the adc_repeat_count_t enum for the list of available repeat count values. |
None. |
ADC0_Tasks()
void ADC0_Tasks (void )
Implements the Tasks routine for the polling implementation.
None. |
None. |
Ensure this function is invoked inside the service loop to maintain proper execution flow.
ADC0_ThresholdCallbackRegister()
void ADC0_ThresholdCallbackRegister (void(*)(void) callback)
Sets the callback function for the Window Comparator Interrupt (WCMP).
*callback |
The pointer to the function to be executed |
None. |
ADC0_ThresholdInterruptDisable()
void ADC0_ThresholdInterruptDisable (void )
Sets the Window Comparator Interrupt Enable (WCMP) bit to 0.
None. |
None. |
ADC0_ThresholdInterruptEnable()
void ADC0_ThresholdInterruptEnable (void )
Sets the Window Comparator Interrupt Enable (WCMP) bit to 1.
None. |
None. |
ADC0_ThresholdInterruptFlagClear()
void ADC0_ThresholdInterruptFlagClear (void )
Clears the Window Comparator Interrupt (WCMP) flag.
None. |
None. |
ADC0_ThresholdModeSet()
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
thresholdMode |
Desired threshold mode. Refer to the adc_threshold_mode_t enum for the list of available threshold modes. |
None. |
ADC0_UpperThresholdSet()
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
upperThreshold |
Upper threshold value of the adc_threshold_t type |
None. |
3.2.2.4.2 ADC
This header file provides type definitions for the ADC module.
Module description
This header file provides type definitions for the ADC module.
Typedefs
typedef int16_t adc_result_t
ADC conversion result type.
typedef int32_t adc_accumulate_t
ADC conversion accumulator type.
typedef int16_t adc_threshold_t
ADC conversion threshold type.
Enumerations
enum adc_posChannel_t { ADC0_POSCHANNEL_AIN0 = 0x0, ADC0_POSCHANNEL_AIN1 = 0x1, ADC0_POSCHANNEL_AIN2 = 0x2, ADC0_POSCHANNEL_AIN3 = 0x3, ADC0_POSCHANNEL_AIN4 = 0x4, ADC0_POSCHANNEL_AIN5 = 0x5, ADC0_POSCHANNEL_AIN6 = 0x6, ADC0_POSCHANNEL_AIN7 = 0x7, ADC0_POSCHANNEL_AIN8 = 0x8, ADC0_POSCHANNEL_AIN9 = 0x9, ADC0_POSCHANNEL_AIN10 = 0xa, ADC0_POSCHANNEL_AIN11 = 0xb, ADC0_POSCHANNEL_AIN16 = 0x10, ADC0_POSCHANNEL_AIN17 = 0x11, ADC0_POSCHANNEL_AIN18 = 0x12, ADC0_POSCHANNEL_AIN19 = 0x13, ADC0_POSCHANNEL_AIN20 = 0x14, ADC0_POSCHANNEL_AIN21 = 0x15, ADC0_POSCHANNEL_GND = 0x40, ADC0_POSCHANNEL_TEMPSENSE = 0x42, ADC0_POSCHANNEL_VDDDIV10 = 0x44, ADC0_POSCHANNEL_VDDIO2DIV10 = 0x45, ADC0_POSCHANNEL_DAC0 = 0x48, ADC0_POSCHANNEL_DACREF0 = 0x49, ADC0_POSCHANNEL_DACREF1 = 0x4a, ADC0_POSCHANNEL_DACREF2 = 0x4b }
Enumeration defining all available positive analog channels for ADC conversion.
enum adc_negChannel_t { ADC0_NEGCHANNEL_AIN0 = 0x0, ADC0_NEGCHANNEL_AIN1 = 0x1, ADC0_NEGCHANNEL_AIN2 = 0x2, ADC0_NEGCHANNEL_AIN3 = 0x3, ADC0_NEGCHANNEL_AIN4 = 0x4, ADC0_NEGCHANNEL_AIN5 = 0x5, ADC0_NEGCHANNEL_AIN6 = 0x6, ADC0_NEGCHANNEL_AIN7 = 0x7, ADC0_NEGCHANNEL_AIN8 = 0x8, ADC0_NEGCHANNEL_AIN9 = 0x9, ADC0_NEGCHANNEL_AIN10 = 0xa, ADC0_NEGCHANNEL_AIN11 = 0xb, ADC0_NEGCHANNEL_GND = 0x40, ADC0_NEGCHANNEL_DAC0 = 0x48 }
Enumeration defining all available negative analog channels for ADC conversion.
enum adc_repeat_count_t { ADC_NO_ACCUMULATION = 0x0, ADC_2_SAMPLES_ACCUMULATED = 0x1, ADC_4_SAMPLES_ACCUMULATED = 0x2, ADC_8_SAMPLES_ACCUMULATED = 0x3, ADC_16_SAMPLES_ACCUMULATED = 0x4, ADC_32_SAMPLES_ACCUMULATED = 0x5, ADC_64_SAMPLES_ACCUMULATED = 0x6, ADC_128_SAMPLES_ACCUMULATED = 0x7 }
Enumeration for the ADC sample length values.
enum adc_channel_t { ADC0_CHANNEL_AIN0 = 0x0, ADC0_CHANNEL_AIN1 = 0x1, ADC0_CHANNEL_AIN2 = 0x2, ADC0_CHANNEL_AIN3 = 0x3, ADC0_CHANNEL_AIN4 = 0x4, ADC0_CHANNEL_AIN5 = 0x5, ADC0_CHANNEL_AIN6 = 0x6, ADC0_CHANNEL_AIN7 = 0x7, ADC0_CHANNEL_AIN8 = 0x8, ADC0_CHANNEL_AIN9 = 0x9, ADC0_CHANNEL_AIN10 = 0xa, ADC0_CHANNEL_AIN11 = 0xb, ADC0_CHANNEL_AIN16 = 0x10, ADC0_CHANNEL_AIN17 = 0x11, ADC0_CHANNEL_AIN18 = 0x12, ADC0_CHANNEL_AIN19 = 0x13, ADC0_CHANNEL_AIN20 = 0x14, ADC0_CHANNEL_AIN21 = 0x15, ADC0_CHANNEL_GND = 0x40, ADC0_CHANNEL_TEMPSENSE = 0x42, ADC0_CHANNEL_VDDDIV10 = 0x44, ADC0_CHANNEL_VDDIO2DIV10 = 0x45, ADC0_CHANNEL_DAC0 = 0x48, ADC0_CHANNEL_DACREF0 = 0x49, ADC0_CHANNEL_DACREF1 = 0x4a, ADC0_CHANNEL_DACREF2 = 0x4b }
Enumeration defining all available analog channels for ADC conversion.
enum adc_computation_mode_t { ADC_BASIC = 0x00, ADC_SERIES_ACCUMULATE = 0x01 }
Enumeration for the ADC computation modes.
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_UPPER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4 }
Enumeration for the ADC window comparator modes.
Typedef Documentation
adc_accumulate_t
adc_accumulate_t
ADC conversion accumulator type.
adc_result_t
adc_result_t
ADC conversion result type.
adc_threshold_t
adc_threshold_t
ADC conversion threshold type.
Enumeration Type Documentation
adc_channel_t
enum adc_channel_t
Enumeration defining all available analog channels for ADC conversion.
ADC0_CHANNEL_AIN0 | PD0 |
ADC0_CHANNEL_AIN1 | PD1 |
ADC0_CHANNEL_AIN2 | PD2 |
ADC0_CHANNEL_AIN3 | PD3 |
ADC0_CHANNEL_AIN4 | PD4 |
ADC0_CHANNEL_AIN5 | PD5 |
ADC0_CHANNEL_AIN6 | PD6 |
ADC0_CHANNEL_AIN7 | PD7 |
ADC0_CHANNEL_AIN8 | PE0 |
ADC0_CHANNEL_AIN9 | PE1 |
ADC0_CHANNEL_AIN10 | PE2 |
ADC0_CHANNEL_AIN11 | PE3 |
ADC0_CHANNEL_AIN16 | PF0 |
ADC0_CHANNEL_AIN17 | PF1 |
ADC0_CHANNEL_AIN18 | PF2 |
ADC0_CHANNEL_AIN19 | PF3 |
ADC0_CHANNEL_AIN20 | PF4 |
ADC0_CHANNEL_AIN21 | PF5 |
ADC0_CHANNEL_GND | Ground |
ADC0_CHANNEL_TEMPSENSE | Temperature sensor |
ADC0_CHANNEL_VDDDIV10 | VDD/10 |
ADC0_CHANNEL_VDDIO2DIV10 | VDDIO2/10 |
ADC0_CHANNEL_DAC0 | DAC0 |
ADC0_CHANNEL_DACREF0 | AC0 DAC Voltage Reference |
ADC0_CHANNEL_DACREF1 | AC1 DAC Voltage Reference |
ADC0_CHANNEL_DACREF2 | AC2 DAC Voltage Reference |
adc_computation_mode_t
enum adc_computation_mode_t
Enumeration for the ADC computation modes.
ADC_BASIC | No accumulation |
ADC_SERIES_ACCUMULATE | Accumulate each sample |
adc_negChannel_t
enum adc_negChannel_t
ADC0_NEGCHANNEL_AIN0 | PD0 |
ADC0_NEGCHANNEL_AIN1 | PD1 |
ADC0_NEGCHANNEL_AIN2 | PD2 |
ADC0_NEGCHANNEL_AIN3 | PD3 |
ADC0_NEGCHANNEL_AIN4 | PD4 |
ADC0_NEGCHANNEL_AIN5 | PD5 |
ADC0_NEGCHANNEL_AIN6 | PD6 |
ADC0_NEGCHANNEL_AIN7 | PD7 |
ADC0_NEGCHANNEL_AIN8 | PE0 |
ADC0_NEGCHANNEL_AIN9 | PE1 |
ADC0_NEGCHANNEL_AIN10 | PE2 |
ADC0_NEGCHANNEL_AIN11 | PE3 |
ADC0_NEGCHANNEL_GND | Ground |
ADC0_NEGCHANNEL_DAC0 | DAC0 |
adc_posChannel_t
enum adc_posChannel_t
ADC0_POSCHANNEL_AIN0 | PD0 |
ADC0_POSCHANNEL_AIN1 | PD1 |
ADC0_POSCHANNEL_AIN2 | PD2 |
ADC0_POSCHANNEL_AIN3 | PD3 |
ADC0_POSCHANNEL_AIN4 | PD4 |
ADC0_POSCHANNEL_AIN5 | PD5 |
ADC0_POSCHANNEL_AIN6 | PD6 |
ADC0_POSCHANNEL_AIN7 | PD7 |
ADC0_POSCHANNEL_AIN8 | PE0 |
ADC0_POSCHANNEL_AIN9 | PE1 |
ADC0_POSCHANNEL_AIN10 | PE2 |
ADC0_POSCHANNEL_AIN11 | PE3 |
ADC0_POSCHANNEL_AIN16 | PF0 |
ADC0_POSCHANNEL_AIN17 | PF1 |
ADC0_POSCHANNEL_AIN18 | PF2 |
ADC0_POSCHANNEL_AIN19 | PF3 |
ADC0_POSCHANNEL_AIN20 | PF4 |
ADC0_POSCHANNEL_AIN21 | PF5 |
ADC0_POSCHANNEL_GND | Ground |
ADC0_POSCHANNEL_TEMPSENSE | Temperature sensor |
ADC0_POSCHANNEL_VDDDIV10 | VDD/10 |
ADC0_POSCHANNEL_VDDIO2DIV10 | VDDIO2/10 |
ADC0_POSCHANNEL_DAC0 | DAC0 |
ADC0_POSCHANNEL_DACREF0 | AC0 DAC Voltage Reference |
ADC0_POSCHANNEL_DACREF1 | AC1 DAC Voltage Reference |
ADC0_POSCHANNEL_DACREF2 | AC2 DAC Voltage Reference |
adc_repeat_count_t
enum adc_repeat_count_t
Enumeration for the ADC sample length values.
ADC_NO_ACCUMULATION | No accumulation |
ADC_2_SAMPLES_ACCUMULATED | 2 results accumulated |
ADC_4_SAMPLES_ACCUMULATED | 4 results accumulated |
ADC_8_SAMPLES_ACCUMULATED | 8 results accumulated |
ADC_16_SAMPLES_ACCUMULATED | 16 results accumulated |
ADC_32_SAMPLES_ACCUMULATED | 32 results accumulated |
ADC_64_SAMPLES_ACCUMULATED | 64 results accumulated |
ADC_128_SAMPLES_ACCUMULATED | 128 results accumulated |
adc_threshold_mode_t
enum adc_threshold_mode_t
Enumeration for the ADC window comparator modes.
ADC_NEVER_INTERRUPT | No Window Comparison |
ADC_BELOW_LOWER_THRESHOLD | Below Window |
ADC_ABOVE_UPPER_THRESHOLD | Above Window |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD | Inside Window |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD | Outside Window |
3.2.2.5 File Documentation
3.2.2.5.1 source/Differential_Interrupts/adc0.h File Reference
#include "../system/utils/compiler.h" #include "./adc_types.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
void ADC0_ConversionDoneInterruptEnable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 1.
void ADC0_ConversionDoneInterruptDisable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 0.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
void ADC0_ThresholdInterruptEnable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 1.
void ADC0_ThresholdInterruptDisable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 0.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
Detailed Description
ADC0 Generated Driver API Header File
3.2.2.5.2 source/Differential_Tasks/adc0.h File Reference
#include "../system/utils/compiler.h" #include "./adc_types.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
void ADC0_Tasks (void)
Implements the Tasks routine for the polling implementation.
Detailed Description
ADC0 Generated Driver API Header File
3.2.2.5.3 source/Single-Ended_Interrupts/adc0.h File Reference
#include "../system/utils/compiler.h" #include "./adc_types.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
void ADC0_ConversionDoneInterruptEnable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 1.
void ADC0_ConversionDoneInterruptDisable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 0.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of one conversion on the selected channel.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
void ADC0_ThresholdInterruptEnable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 1.
void ADC0_ThresholdInterruptDisable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 0.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
Detailed Description
ADC0 Generated Driver API Header File
3.2.2.5.4 source/Single-Ended_Tasks/adc0.h File Reference
#include "../system/utils/compiler.h" #include "./adc_types.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of one conversion on the selected channel.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
void ADC0_Tasks (void)
Implements the Tasks routine for the polling implementation.
Detailed Description
ADC0 Generated Driver API Header File
3.2.2.5.5 source/Differential_Interrupts/adc_types.h File Reference
#include <stdint.h>
Typedefs
typedef int16_t adc_result_t
ADC conversion result type.
typedef int32_t adc_accumulate_t
ADC conversion accumulator type.
typedef int16_t adc_threshold_t
ADC conversion threshold type.
Enumerations
-
enum adc_posChannel_t { ADC0_POSCHANNEL_AIN0 = 0x0, ADC0_POSCHANNEL_AIN1 = 0x1, ADC0_POSCHANNEL_AIN2 = 0x2, ADC0_POSCHANNEL_AIN3 = 0x3, ADC0_POSCHANNEL_AIN4 = 0x4, ADC0_POSCHANNEL_AIN5 = 0x5, ADC0_POSCHANNEL_AIN6 = 0x6, ADC0_POSCHANNEL_AIN7 = 0x7, ADC0_POSCHANNEL_AIN8 = 0x8, ADC0_POSCHANNEL_AIN9 = 0x9, ADC0_POSCHANNEL_AIN10 = 0xa, ADC0_POSCHANNEL_AIN11 = 0xb, ADC0_POSCHANNEL_AIN16 = 0x10, ADC0_POSCHANNEL_AIN17 = 0x11, ADC0_POSCHANNEL_AIN18 = 0x12, ADC0_POSCHANNEL_AIN19 = 0x13, ADC0_POSCHANNEL_AIN20 = 0x14, ADC0_POSCHANNEL_AIN21 = 0x15, ADC0_POSCHANNEL_GND = 0x40, ADC0_POSCHANNEL_TEMPSENSE = 0x42, ADC0_POSCHANNEL_VDDDIV10 = 0x44, ADC0_POSCHANNEL_VDDIO2DIV10 = 0x45, ADC0_POSCHANNEL_DAC0 = 0x48, ADC0_POSCHANNEL_DACREF0 = 0x49, ADC0_POSCHANNEL_DACREF1 = 0x4a, ADC0_POSCHANNEL_DACREF2 = 0x4b }
Enumeration defining all available positive analog channels for ADC conversion.
-
enum adc_negChannel_t { ADC0_NEGCHANNEL_AIN0 = 0x0, ADC0_NEGCHANNEL_AIN1 = 0x1, ADC0_NEGCHANNEL_AIN2 = 0x2, ADC0_NEGCHANNEL_AIN3 = 0x3, ADC0_NEGCHANNEL_AIN4 = 0x4, ADC0_NEGCHANNEL_AIN5 = 0x5, ADC0_NEGCHANNEL_AIN6 = 0x6, ADC0_NEGCHANNEL_AIN7 = 0x7, ADC0_NEGCHANNEL_AIN8 = 0x8, ADC0_NEGCHANNEL_AIN9 = 0x9, ADC0_NEGCHANNEL_AIN10 = 0xa, ADC0_NEGCHANNEL_AIN11 = 0xb, ADC0_NEGCHANNEL_GND = 0x40, ADC0_NEGCHANNEL_DAC0 = 0x48 }
-
Enumeration defining all available negative analog channels for ADC conversion.
enum adc_computation_mode_t { ADC_BASIC = 0x00, ADC_SERIES_ACCUMULATE = 0x01 }
Enumeration for the ADC computation modes.
enum adc_repeat_count_t { ADC_NO_ACCUMULATION = 0x0, ADC_2_SAMPLES_ACCUMULATED = 0x1, ADC_4_SAMPLES_ACCUMULATED = 0x2, ADC_8_SAMPLES_ACCUMULATED = 0x3, ADC_16_SAMPLES_ACCUMULATED = 0x4, ADC_32_SAMPLES_ACCUMULATED = 0x5, ADC_64_SAMPLES_ACCUMULATED = 0x6, ADC_128_SAMPLES_ACCUMULATED = 0x7 }
Enumeration for the ADC sample length values.
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_UPPER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4 }
Enumeration for the ADC window comparator modes.
Detailed Description
ADC Type Definitions Header File
3.2.2.5.6 source/Differential_Tasks/adc_types.h File Reference
#include <stdint.h>
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
Enumerations
-
enum adc_posChannel_t { ADC0_POSCHANNEL_AIN0 = 0x0, ADC0_POSCHANNEL_AIN1 = 0x1, ADC0_POSCHANNEL_AIN2 = 0x2, ADC0_POSCHANNEL_AIN3 = 0x3, ADC0_POSCHANNEL_AIN4 = 0x4, ADC0_POSCHANNEL_AIN5 = 0x5, ADC0_POSCHANNEL_AIN6 = 0x6, ADC0_POSCHANNEL_AIN7 = 0x7, ADC0_POSCHANNEL_AIN8 = 0x8, ADC0_POSCHANNEL_AIN9 = 0x9, ADC0_POSCHANNEL_AIN10 = 0xa, ADC0_POSCHANNEL_AIN11 = 0xb, ADC0_POSCHANNEL_AIN16 = 0x10, ADC0_POSCHANNEL_AIN17 = 0x11, ADC0_POSCHANNEL_AIN18 = 0x12, ADC0_POSCHANNEL_AIN19 = 0x13, ADC0_POSCHANNEL_AIN20 = 0x14, ADC0_POSCHANNEL_AIN21 = 0x15, ADC0_POSCHANNEL_GND = 0x40, ADC0_POSCHANNEL_TEMPSENSE = 0x42, ADC0_POSCHANNEL_VDDDIV10 = 0x44, ADC0_POSCHANNEL_VDDIO2DIV10 = 0x45, ADC0_POSCHANNEL_DAC0 = 0x48, ADC0_POSCHANNEL_DACREF0 = 0x49, ADC0_POSCHANNEL_DACREF1 = 0x4a, ADC0_POSCHANNEL_DACREF2 = 0x4b }
Enumeration defining all available positive analog channels for ADC conversion.
-
enum adc_negChannel_t { ADC0_NEGCHANNEL_AIN0 = 0x0, ADC0_NEGCHANNEL_AIN1 = 0x1, ADC0_NEGCHANNEL_AIN2 = 0x2, ADC0_NEGCHANNEL_AIN3 = 0x3, ADC0_NEGCHANNEL_AIN4 = 0x4, ADC0_NEGCHANNEL_AIN5 = 0x5, ADC0_NEGCHANNEL_AIN6 = 0x6, ADC0_NEGCHANNEL_AIN7 = 0x7, ADC0_NEGCHANNEL_AIN8 = 0x8, ADC0_NEGCHANNEL_AIN9 = 0x9, ADC0_NEGCHANNEL_AIN10 = 0xa, ADC0_NEGCHANNEL_AIN11 = 0xb, ADC0_NEGCHANNEL_GND = 0x40, ADC0_NEGCHANNEL_DAC0 = 0x48 }
enum adc_computation_mode_t { ADC_BASIC = 0x00, ADC_SERIES_ACCUMULATE = 0x01 }
enum adc_repeat_count_t { ADC_NO_ACCUMULATION = 0x0, ADC_2_SAMPLES_ACCUMULATED = 0x1, ADC_4_SAMPLES_ACCUMULATED = 0x2, ADC_8_SAMPLES_ACCUMULATED = 0x3, ADC_16_SAMPLES_ACCUMULATED = 0x4, ADC_32_SAMPLES_ACCUMULATED = 0x5, ADC_64_SAMPLES_ACCUMULATED = 0x6, ADC_128_SAMPLES_ACCUMULATED = 0x7 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_UPPER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC | No accumulation |
ADC_SERIES_ACCUMULATE | Accumulate each sample |
adc_negChannel_t
enum adc_negChannel_t
ADC0_NEGCHANNEL_AIN0 | PD0 |
ADC0_NEGCHANNEL_AIN1 | PD1 |
ADC0_NEGCHANNEL_AIN2 | PD2 |
ADC0_NEGCHANNEL_AIN3 | PD3 |
ADC0_NEGCHANNEL_AIN4 | PD4 |
ADC0_NEGCHANNEL_AIN5 | PD5 |
ADC0_NEGCHANNEL_AIN6 | PD6 |
ADC0_NEGCHANNEL_AIN7 | PD7 |
ADC0_NEGCHANNEL_AIN8 | PE0 |
ADC0_NEGCHANNEL_AIN9 | PE1 |
ADC0_NEGCHANNEL_AIN10 | PE2 |
ADC0_NEGCHANNEL_AIN11 | PE3 |
ADC0_NEGCHANNEL_GND | Ground |
ADC0_NEGCHANNEL_DAC0 | DAC0 |
adc_posChannel_t
enum adc_posChannel_t
ADC0_POSCHANNEL_AIN0 | PD0 |
ADC0_POSCHANNEL_AIN1 | PD1 |
ADC0_POSCHANNEL_AIN2 | PD2 |
ADC0_POSCHANNEL_AIN3 | PD3 |
ADC0_POSCHANNEL_AIN4 | PD4 |
ADC0_POSCHANNEL_AIN5 | PD5 |
ADC0_POSCHANNEL_AIN6 | PD6 |
ADC0_POSCHANNEL_AIN7 | PD7 |
ADC0_POSCHANNEL_AIN8 | PE0 |
ADC0_POSCHANNEL_AIN9 | PE1 |
ADC0_POSCHANNEL_AIN10 | PE2 |
ADC0_POSCHANNEL_AIN11 | PE3 |
ADC0_POSCHANNEL_AIN16 | PF0 |
ADC0_POSCHANNEL_AIN17 | PF1 |
ADC0_POSCHANNEL_AIN18 | PF2 |
ADC0_POSCHANNEL_AIN19 | PF3 |
ADC0_POSCHANNEL_AIN20 | PF4 |
ADC0_POSCHANNEL_AIN21 | PF5 |
ADC0_POSCHANNEL_GND | Ground |
ADC0_POSCHANNEL_TEMPSENSE | Temperature sensor |
ADC0_POSCHANNEL_VDDDIV10 | VDD/10 |
ADC0_POSCHANNEL_VDDIO2DIV10 | VDDIO2/10 |
ADC0_POSCHANNEL_DAC0 | DAC0 |
ADC0_POSCHANNEL_DACREF0 | AC0 DAC Voltage Reference |
ADC0_POSCHANNEL_DACREF1 | AC1 DAC Voltage Reference |
ADC0_POSCHANNEL_DACREF2 | AC2 DAC Voltage Reference |
adc_repeat_count_t
enum adc_repeat_count_t
ADC_NO_ACCUMULATION | No accumulation |
ADC_2_SAMPLES_ACCUMULATED | 2 results accumulated |
ADC_4_SAMPLES_ACCUMULATED | 4 results accumulated |
ADC_8_SAMPLES_ACCUMULATED | 8 results accumulated |
ADC_16_SAMPLES_ACCUMULATED | 16 results accumulated |
ADC_32_SAMPLES_ACCUMULATED | 32 results accumulated |
ADC_64_SAMPLES_ACCUMULATED | 64 results accumulated |
ADC_128_SAMPLES_ACCUMULATED | 128 results accumulated |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT | No Window Comparison |
ADC_BELOW_LOWER_THRESHOLD | Below Window |
ADC_ABOVE_UPPER_THRESHOLD | Above Window |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD | Inside Window |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD | Outside Window |
3.2.2.5.7 source/Single-Ended_Interrupts/adc_types.h File Reference
#include <stdint.h>
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
Enumerations
enum adc_channel_t { ADC0_CHANNEL_AIN0 = 0x0, ADC0_CHANNEL_AIN1 = 0x1, ADC0_CHANNEL_AIN2 = 0x2, ADC0_CHANNEL_AIN3 = 0x3, ADC0_CHANNEL_AIN4 = 0x4, ADC0_CHANNEL_AIN5 = 0x5, ADC0_CHANNEL_AIN6 = 0x6, ADC0_CHANNEL_AIN7 = 0x7, ADC0_CHANNEL_AIN8 = 0x8, ADC0_CHANNEL_AIN9 = 0x9, ADC0_CHANNEL_AIN10 = 0xa, ADC0_CHANNEL_AIN11 = 0xb, ADC0_CHANNEL_AIN16 = 0x10, ADC0_CHANNEL_AIN17 = 0x11, ADC0_CHANNEL_AIN18 = 0x12, ADC0_CHANNEL_AIN19 = 0x13, ADC0_CHANNEL_AIN20 = 0x14, ADC0_CHANNEL_AIN21 = 0x15, ADC0_CHANNEL_GND = 0x40, ADC0_CHANNEL_TEMPSENSE = 0x42, ADC0_CHANNEL_VDDDIV10 = 0x44, ADC0_CHANNEL_VDDIO2DIV10 = 0x45, ADC0_CHANNEL_DAC0 = 0x48, ADC0_CHANNEL_DACREF0 = 0x49, ADC0_CHANNEL_DACREF1 = 0x4a, ADC0_CHANNEL_DACREF2 = 0x4b }
Enumeration defining all available analog channels for ADC conversion.
enum adc_computation_mode_t { ADC_BASIC = 0x00, ADC_SERIES_ACCUMULATE = 0x01 }
enum adc_repeat_count_t { ADC_NO_ACCUMULATION = 0x0, ADC_2_SAMPLES_ACCUMULATED = 0x1, ADC_4_SAMPLES_ACCUMULATED = 0x2, ADC_8_SAMPLES_ACCUMULATED = 0x3, ADC_16_SAMPLES_ACCUMULATED = 0x4, ADC_32_SAMPLES_ACCUMULATED = 0x5, ADC_64_SAMPLES_ACCUMULATED = 0x6, ADC_128_SAMPLES_ACCUMULATED = 0x7 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_UPPER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC | No accumulation |
ADC_SERIES_ACCUMULATE | Accumulate each sample |
adc_repeat_count_t
enum adc_repeat_count_t
ADC_NO_ACCUMULATION | No accumulation |
ADC_2_SAMPLES_ACCUMULATED | 2 results accumulated |
ADC_4_SAMPLES_ACCUMULATED | 4 results accumulated |
ADC_8_SAMPLES_ACCUMULATED | 8 results accumulated |
ADC_16_SAMPLES_ACCUMULATED | 16 results accumulated |
ADC_32_SAMPLES_ACCUMULATED | 32 results accumulated |
ADC_64_SAMPLES_ACCUMULATED | 64 results accumulated |
ADC_128_SAMPLES_ACCUMULATED | 128 results accumulated |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT | No Window Comparison |
ADC_BELOW_LOWER_THRESHOLD | Below Window |
ADC_ABOVE_UPPER_THRESHOLD | Above Window |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD | Inside Window |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD | Outside Window |
3.2.2.5.8 source/Single-Ended_Tasks/adc_types.h File Reference
#include <stdint.h>
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
Enumerations
enum adc_channel_t { ADC0_CHANNEL_AIN0 = 0x0, ADC0_CHANNEL_AIN1 = 0x1, ADC0_CHANNEL_AIN2 = 0x2, ADC0_CHANNEL_AIN3 = 0x3, ADC0_CHANNEL_AIN4 = 0x4, ADC0_CHANNEL_AIN5 = 0x5, ADC0_CHANNEL_AIN6 = 0x6, ADC0_CHANNEL_AIN7 = 0x7, ADC0_CHANNEL_AIN8 = 0x8, ADC0_CHANNEL_AIN9 = 0x9, ADC0_CHANNEL_AIN10 = 0xa, ADC0_CHANNEL_AIN11 = 0xb, ADC0_CHANNEL_AIN16 = 0x10, ADC0_CHANNEL_AIN17 = 0x11, ADC0_CHANNEL_AIN18 = 0x12, ADC0_CHANNEL_AIN19 = 0x13, ADC0_CHANNEL_AIN20 = 0x14, ADC0_CHANNEL_AIN21 = 0x15, ADC0_CHANNEL_GND = 0x40, ADC0_CHANNEL_TEMPSENSE = 0x42, ADC0_CHANNEL_VDDDIV10 = 0x44, ADC0_CHANNEL_VDDIO2DIV10 = 0x45, ADC0_CHANNEL_DAC0 = 0x48, ADC0_CHANNEL_DACREF0 = 0x49, ADC0_CHANNEL_DACREF1 = 0x4a, ADC0_CHANNEL_DACREF2 = 0x4b }
enum adc_computation_mode_t { ADC_BASIC = 0x00, ADC_SERIES_ACCUMULATE = 0x01 }
enum adc_repeat_count_t { ADC_NO_ACCUMULATION = 0x0, ADC_2_SAMPLES_ACCUMULATED = 0x1, ADC_4_SAMPLES_ACCUMULATED = 0x2, ADC_8_SAMPLES_ACCUMULATED = 0x3, ADC_16_SAMPLES_ACCUMULATED = 0x4, ADC_32_SAMPLES_ACCUMULATED = 0x5, ADC_64_SAMPLES_ACCUMULATED = 0x6, ADC_128_SAMPLES_ACCUMULATED = 0x7 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_UPPER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_channel_t
enum adc_channel_t
ADC0_CHANNEL_AIN0 | PD0 |
ADC0_CHANNEL_AIN1 | PD1 |
ADC0_CHANNEL_AIN2 | PD2 |
ADC0_CHANNEL_AIN3 | PD3 |
ADC0_CHANNEL_AIN4 | PD4 |
ADC0_CHANNEL_AIN5 | PD5 |
ADC0_CHANNEL_AIN6 | PD6 |
ADC0_CHANNEL_AIN7 | PD7 |
ADC0_CHANNEL_AIN8 | PE0 |
ADC0_CHANNEL_AIN9 | PE1 |
ADC0_CHANNEL_AIN10 | PE2 |
ADC0_CHANNEL_AIN11 | PE3 |
ADC0_CHANNEL_AIN16 | PF0 |
ADC0_CHANNEL_AIN17 | PF1 |
ADC0_CHANNEL_AIN18 | PF2 |
ADC0_CHANNEL_AIN19 | PF3 |
ADC0_CHANNEL_AIN20 | PF4 |
ADC0_CHANNEL_AIN21 | PF5 |
ADC0_CHANNEL_GND | Ground |
ADC0_CHANNEL_TEMPSENSE | Temperature sensor |
ADC0_CHANNEL_VDDDIV10 | VDD/10 |
ADC0_CHANNEL_VDDIO2DIV10 | VDDIO2/10 |
ADC0_CHANNEL_DAC0 | DAC0 |
ADC0_CHANNEL_DACREF0 | AC0 DAC Voltage Reference |
ADC0_CHANNEL_DACREF1 | AC1 DAC Voltage Reference |
ADC0_CHANNEL_DACREF2 | AC2 DAC Voltage Reference |
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC | No accumulation |
ADC_SERIES_ACCUMULATE | Accumulate each sample |
adc_repeat_count_t
enum adc_repeat_count_t
ADC_NO_ACCUMULATION | No accumulation |
ADC_2_SAMPLES_ACCUMULATED | 2 results accumulated |
ADC_4_SAMPLES_ACCUMULATED | 4 results accumulated |
ADC_8_SAMPLES_ACCUMULATED | 8 results accumulated |
ADC_16_SAMPLES_ACCUMULATED | 16 results accumulated |
ADC_32_SAMPLES_ACCUMULATED | 32 results accumulated |
ADC_64_SAMPLES_ACCUMULATED | 64 results accumulated |
ADC_128_SAMPLES_ACCUMULATED | 128 results accumulated |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT | No Window Comparison |
ADC_BELOW_LOWER_THRESHOLD | Below Window |
ADC_ABOVE_UPPER_THRESHOLD | Above Window |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD | Inside Window |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD | Outside Window |
3.2.2.5.9 source/Differential_Interrupts/src/adc0.c File Reference
This file contains the API implementations for the ADC0 driver.
#include "../adc0.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
void ADC0_ConversionDoneInterruptEnable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 1.
void ADC0_ConversionDoneInterruptDisable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 0.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
void ADC0_ThresholdInterruptEnable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 1.
void ADC0_ThresholdInterruptDisable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 0.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
ISR (ADC0_RESRDY_vect)
ISR (ADC0_WCMP_vect)
Variables
static void(* ADC0_ConversionDoneCallback )(void)
static void(* ADC0_ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC0 driver.
ADC0 Generated Driver File
Function Documentation
ISR()[1/2]
ISR (ADC0_RESRDY_vect )
ISR()[2/2]
ISR (ADC0_WCMP_vect )
Variable Documentation
ADC0_ConversionDoneCallback
void(* ADC0_ConversionDoneCallback) (void)[static]
ADC0_ThresholdCallback
void(* ADC0_ThresholdCallback) (void)[static]
3.2.2.5.10 source/Differential_Tasks/src/adc0.c File Reference
This file contains the API implementations for the ADC0 driver.
#include "../adc0.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
void ADC0_Tasks (void)
Implements the Tasks routine for the polling implementation.
Variables
static void(* ADC0_ConversionDoneCallback )(void)
static void(* ADC0_ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC0 driver.
ADC0 Generated Driver File
Variable Documentation
ADC0_ConversionDoneCallback
void(* ADC0_ConversionDoneCallback) (void)[static]
ADC0_ThresholdCallback
void(* ADC0_ThresholdCallback) (void)[static]
3.2.2.5.11 source/Single-Ended_Interrupts/src/adc0.c File Reference
This file contains the API implementations for the ADC0 driver.
#include "../adc0.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
void ADC0_ConversionDoneInterruptEnable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 1.
void ADC0_ConversionDoneInterruptDisable (void)
Sets the Result Ready Interrupt Enable (RESRDY) bit to 0.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of one conversion on the selected channel.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
void ADC0_ThresholdInterruptEnable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 1.
void ADC0_ThresholdInterruptDisable (void)
Sets the Window Comparator Interrupt Enable (WCMP) bit to 0.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
ISR (ADC0_RESRDY_vect)
ISR (ADC0_WCMP_vect)
Variables
static void(* ADC0_ConversionDoneCallback )(void)
static void(* ADC0_ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC0 driver.
ADC0 Generated Driver File
Function Documentation
ISR()[1/2]
ISR (ADC0_RESRDY_vect )
ISR()[2/2]
ISR (ADC0_WCMP_vect )
Variable Documentation
ADC0_ConversionDoneCallback
void(* ADC0_ConversionDoneCallback) (void)[static]
ADC0_ThresholdCallback
void(* ADC0_ThresholdCallback) (void)[static]
3.2.2.5.12 source/Single-Ended_Tasks/src/adc0.c File Reference
This file contains the API implementations for the ADC0 driver.
#include "../adc0.h"
Functions
void ADC0_Initialize (void)
Initializes the registers based on the configurable options in the MPLAB® Code Configurator (MCC) Melody UI for the Analog-to-Digital Converter (ADC) operation.
void ADC0_Deinitialize (void)
Deinitializes the registers to Power-on Reset values.
void ADC0_Enable (void)
Sets the ADC Enable bit to 1.
void ADC0_Disable (void)
Sets the ADC Enable bit to 0.
void ADC0_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion.
void ADC0_ConversionStart (void)
Starts the ADC conversion on the selected channels.
bool ADC0_IsConversionDone (void)
Checks if the ongoing ADC conversion is complete.
adc_result_t ADC0_ConversionResultGet (void)
Retrieves the result of the latest conversion.
void ADC0_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the Result Ready Interrupt (RESRDY).
adc_result_t ADC0_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of one conversion on the selected channel.
uint8_t ADC0_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC0_ConversionStop (void)
Stops the ongoing ADC conversion.
void ADC0_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the Sample Length with the specified value.
void ADC0_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the Computation mode.
void ADC0_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the Window Comparator High Threshold (WINHT) register.
void ADC0_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the Window Comparator Low Threshold (WINLT) register.
void ADC0_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the Window Comparator mode.
adc_accumulate_t ADC0_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions.
void ADC0_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback function for the Window Comparator Interrupt (WCMP).
void ADC0_ContinuousConversionEnable (void)
Sets the Free-Running (FREERUN) bit to 1.
void ADC0_ContinuousConversionDisable (void)
Sets the Free-Running (FREERUN) bit to 0.
void ADC0_AutoTriggerEnable (void)
Sets the Start Event Input (STARTEI) bit to 1.
void ADC0_AutoTriggerDisable (void)
Sets the Start Event Input (STARTEI) bit to 0.
bool ADC0_IsConversionDoneInterruptFlagSet (void)
Checks the Result Ready Interrupt (RESRDY) flag status.
void ADC0_ConversionDoneInterruptFlagClear (void)
Clears the Result Ready Interrupt (RESRDY) flag.
bool ADC0_IsThresholdInterruptFlagSet (void)
Checks the Window Comparator Interrupt (WCMP) flag status.
void ADC0_ThresholdInterruptFlagClear (void)
Clears the Window Comparator Interrupt (WCMP) flag.
void ADC0_Tasks (void)
Implements the Tasks routine for the polling implementation.
Variables
static void(* ADC0_ConversionDoneCallback )(void)
static void(* ADC0_ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC0 driver.
ADC0 Generated Driver File
Variable Documentation
ADC0_ConversionDoneCallback
void(* ADC0_ConversionDoneCallback) (void)[static]
ADC0_ThresholdCallback
void(* ADC0_ThresholdCallback) (void)[static]