3.1.3.1 12-bit ADCC with Context
12-bit Analog-to-Digital Converter with Computation and Context (ADC3)
3.1.3.1.1 Introduction
The Analog-to-Digital Converter with Computation and Context (ADC3) conversion of both single-ended and differential analog input signals to a 12-bit binary representation of that signal. This device uses analog inputs, which are multiplexed into a single sample and hold circuit. The output of the sample and hold is connected to the input of the converter. The converter generates a 12-bit binary result via successive approximation and stores the conversion result into the ADC result registers.
3.1.3.1.2 Supported Device Families
PIC18F-Q71 | PIC18F-Q8x |
3.1.3.1.3 Required Header Files:
#include "mcc_generated_files/adc/adc.h"
3.1.3.1.4 How to use the ADC3 PLIB Driver
The ADC3 Module driver generates an API interface to support the features of the peripheral. Some use cases of are linked below. Click the links to view the code snippets associated with each.
- Melody ADCCC Use Case 1 - Configure ADC Basic Mode & Data Streamer: Single-Ended ADC sample, with output plotted using the Data Streamer protocol on the Data Visualizer.
- Melody ADCCC Use Case 2 - ADCCC in Burst Average mode with DataStreamer of ADC Result: The ADC takes and averages 16 samples, to mitigate noise. The averaged ADC result is sent to DataStreamer, for display in Data Visualizer. After each ADC conversion is completed and sent to DataStreamer the onboard LED is toggled.
- Melody ADCCC Use Case 3 - Leveraging ADCCC Functionality to Mitigate Periodic Noise and Displaying using DataStreamer.: This Use Case uses the Signal and Noise Generator board, along with the Curiosity Nano Base and Q71 Curiosity Nano development board. The ADC is configured to use the System Clock prescaled as its base clock. The user can then tune away from periodic noise by modifying the number of samples accumulated and thus the acquisition count/time. The filtered ADC result is sent to DataStreamer, for display in Data Visualizer. After each ADC conversion is completed and sent to DataStreamer the onboard LED is toggled.
- Melody ADCCC Use Case 4 - Window Detection: Create an ADC window detector with upper and lower thresholds. Lower bound 1.0V and upper bound 2.0V. Take a single ADC read and compare to window thresholds. If outside of user defined window (above 2.0V or below 1.0V), turn on LED.
- Melody ADCCC Use Case 5 - Using FVR as ADC voltage reference to scale ADC reads: This is useful when working with a small single-ended analog signal that does not use full range from GND to VDD. This Use Case narrows the ADC window of interest using FVR (Fixed Voltage Reference) predefined voltage references: 1.024V, 2.048V, 4.096V.
- Melody ADCCC Use Case 6 - Using DAC as ADC voltage reference: This is useful when working with a small analog signal that does not range from GND to VDD. This Use Case narrows the range of the ADC window using the DAC as a reference, which is useful when one of the FVR internal references (see ADCCC Use Case 5) is not close enough to the ADC range of interest. The user can set a specific reference voltage in order to maximize the ADC resolution over the ADC input range of interest.
3.1.3.1.5 Module Documentation
Analog-to-Digital Converter (ADC)
This file provides API prototypes for the ADC driver.
Module description
This file provides API prototypes for the ADC driver.
This 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.
typedef uint8_t adc_repeat_count_t
ADC conversion repeat count type.
Definitions
#define ADC_RESOLUTION 12
ADC resolution value.
#define ADC_BIT_SET 1
ADC bit set value.
#define ADC_BIT_CLEAR 0
ADC bit clear value.
Enumerations
enum adc_posChannel_t { ADC_POSCHANNEL_ANA1 = 0x1, ADC_POSCHANNEL_VSS = 0x3b }
Enumeration in Differential mode that contains the available ADC positive channels.
enum adc_negChannel_t { ADC_NEGCHANNEL_ANA3 = 0x3, ADC_NEGCHANNEL_VSS = 0x3b }
Enumeration in Differential mode that contains the available ADC negative channels.
enum adc_context_t { context_1 = 0, context_2 = 1, context_3 = 2, context_4 = 3 }
Contains the available ADC contexts.
enum adc_channel_t { ADC_CHANNEL_VSS = 0x3b, ADC_CHANNEL_TEMP = 0x3c, ADC_CHANNEL_DAC1 = 0x3d, ADC_CHANNEL_FVR_BUFFER1 = 0x3e, ADC_CHANNEL_FVR_BUFFER2 = 0x3f, ADC_CHANNEL_ANA1 = 0x1, ADC_CHANNEL_ANA2 = 0x2, ADC_CHANNEL_ANA6 = 0x6, ADC_CHANNEL_ANB2 = 0xa, ADC_CHANNEL_ANB4 = 0xc, ADC_CHANNEL_ANC1 = 0x11 }
Enumeration in Single-Ended mode that describes the available ADC channels.
enum adc_computation_mode_t { ADC_BASIC = 0x0, ADC_SERIES_ACCUMULATE = 0x1, ADC_SERIES_AVERAGE = 0x2, ADC_BURST_AVERAGE = 0x3, ADC_LOW_PASS_FILTER = 0x4 }
Enumeration for the ADC computation modes.
enum adc_calculation_mode_t { ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5 }
Enumeration for the ADC error calculation modes.
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_LOWER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4, ADC_BELOW_UPPER_THRESHOLD = 0x5, ADC_ABOVE_UPPER_THRESHOLD = 0x6, ADC_ALWAYS_INTERRUPT = 0x7 }
Enumeration for the ADC threshold modes.
enum adc_trigger_source_t { ADC_TRIGGER_SOURCE_DISABLED = 0x0, ADC_TRIGGER_SOURCE_ADACTPPS = 0x1, ADC_TRIGGER_SOURCE_TMR0 = 0x2, ADC_TRIGGER_SOURCE_TMR1 = 0x3, ADC_TRIGGER_SOURCE_TMR2 = 0x4, ADC_TRIGGER_SOURCE_TMR3 = 0x5, ADC_TRIGGER_SOURCE_TMR4 = 0x6, ADC_TRIGGER_SOURCE_TMR5 = 0x7, ADC_TRIGGER_SOURCE_TMR6 = 0x8, ADC_TRIGGER_SOURCE_SMT1_OVERFLOW = 0xe, ADC_TRIGGER_SOURCE_CCP1 = 0xf, ADC_TRIGGER_SOURCE_CCP2 = 0x10, ADC_TRIGGER_SOURCE_CCP3 = 0x11, ADC_TRIGGER_SOURCE_PWM1_OUT1 = 0x12, ADC_TRIGGER_SOURCE_PWM1_OUT2 = 0x13, ADC_TRIGGER_SOURCE_PWM2_OUT1 = 0x14, ADC_TRIGGER_SOURCE_PWM2_OUT2 = 0x15, ADC_TRIGGER_SOURCE_PWM3_OUT1 = 0x16, ADC_TRIGGER_SOURCE_PWM3_OUT2 = 0x17, ADC_TRIGGER_SOURCE_NCO1 = 0x1a, ADC_TRIGGER_SOURCE_NCO2 = 0x1b, ADC_TRIGGER_SOURCE_NCO3 = 0x1c, ADC_TRIGGER_SOURCE_CMP1 = 0x1d, ADC_TRIGGER_SOURCE_CMP2 = 0x1e, ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS = 0x1f, ADC_TRIGGER_SOURCE_CLC1 = 0x20, ADC_TRIGGER_SOURCE_CLC2 = 0x21, ADC_TRIGGER_SOURCE_CLC3 = 0x22, ADC_TRIGGER_SOURCE_CLC4 = 0x23, ADC_TRIGGER_SOURCE_CLC5 = 0x24, ADC_TRIGGER_SOURCE_CLC6 = 0x25, ADC_TRIGGER_SOURCE_CLC7 = 0x26, ADC_TRIGGER_SOURCE_CLC8 = 0x27, ADC_TRIGGER_SOURCE_ADERRH = 0x3d, ADC_TRIGGER_SOURCE_ADRESH = 0x3e, ADC_TRIGGER_SOURCE_ADPCH = 0x3f }
Enumeration for the ADC auto-trigger sources.
enum adc_conversion_stage_t { ADC_NOT_CONVERTING = 0x0, ADC_1ST_PRECHARGE = 0x1, ADC_1ST_ACQUISITION = 0x2, ADC_1ST_CONVERSION = 0x3, ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE = 0x4, ADC_2ND_PRECHARGE = 0x5, ADC_2ND_ACQUISITION = 0x6, ADC_2ND_CONVERSION = 0x7 }
Enumeration for the ADC conversion stage statuses.
Functions
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
void ADC_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion in the current context.
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
void ADC_ConversionStop (void)
Stops the ongoing conversion.
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
adc_result_t ADC_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels for the current context.
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
void ADC_ConversionDoneInterruptEnable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '1'.
void ADC_ConversionDoneInterruptDisable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '0'.
void ADC_ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to '1' for the current context.
void ADC_ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to '0' for the current context.
void ADC_Context1ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '1' for ADC Context 1.
void ADC_Context1ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '0' for ADC Context 1.
void ADC_Context2ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '1' for ADC Context 2.
void ADC_Context2ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '0' for ADC Context 2.
void ADC_Context3ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '1' for ADC Context 3.
void ADC_Context3ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '0' for ADC Context 3.
void ADC_Context4ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '1' for ADC Context 4.
void ADC_Context4ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '0' for ADC Context 4.
void ADC_ISR (void)
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
void ADC_Context1ThresholdISR (void)
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
void ADC_Context2ThresholdISR (void)
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
void ADC_Context3ThresholdISR (void)
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
void ADC_Context4ThresholdISR (void)
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
void ADC_Tasks (void)
Implements the Tasks routine for the polling implementations.
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
void ADC_ChargePumpEnable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '1'.
void ADC_ChargePumpDisable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '0'.
bool ADC_IsChargePumpReady (void)
Checks the Charge Pump Ready status.
Definition Documentation
ADC_BIT_CLEAR
#define ADC_BIT_CLEAR 0
ADC bit clear value.
ADC_BIT_SET
#define ADC_BIT_SET 1
ADC bit set value.
ADC_RESOLUTION
#define ADC_RESOLUTION 12
ADC resolution value.
Typedef Documentation
adc_accumulate_t
adc_accumulate_t
ADC conversion accumulator type.
adc_repeat_count_t
adc_repeat_count_t
ADC conversion repeat count type.
adc_result_t
adc_result_t
ADC conversion result type.
adc_threshold_t
adc_threshold_t
ADC conversion threshold type.
Function Documentation
ADC_AccumulatedResultGet()
adc_accumulate_t ADC_AccumulatedResultGet (void )
Retrieves the value of the accumulated conversions for the current context.
None. |
adc_accumulate_t - Value of ADC accumulator register |
ADC_AccumulatorClear()
void ADC_AccumulatorClear (void )
Clears the accumulator for the current context.
None. |
None. |
ADC_AcquisitionTimeSet()
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
acquisitionValue |
Value to be loaded in the ADACQ register |
None. |
ADC_AutoTriggerSourceSet()
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
triggerSource |
Desired auto conversion trigger source. Refer to the adc_trigger_source_t for the list of available trigger sources. |
None. |
ADC_BusyStatusSet()
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
status |
True to set the ADC status to busy, false to set it to not busy. |
None. |
ADC_CalculationRightShiftSet()
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
rightShiftValue |
Right shift value |
None. |
ADC_ChannelScanDisable()
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
context |
The desired context. Refer to adc_context_t for the available context options. |
None. |
ADC_ChannelScanEnable()
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
context |
The desired context. Refer to adc_context_t for the available context options. |
None. |
ADC_ChannelSelect()
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
channel |
Desired analog channel. Refer to the adc_channel_t enum for the list of available analog channels. |
None. |
ADC_ChannelSelectAndConvert()
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
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 |
ADC_ChannelSequencerDisable()
void ADC_ChannelSequencerDisable (void )
Disables the ADC channel sequencer.
None. |
None. |
ADC_ChannelSequencerEnable()
void ADC_ChannelSequencerEnable (void )
Enables the ADC channel sequencer.
None. |
None. |
ADC_ChargePumpDisable()
void ADC_ChargePumpDisable (void )
Sets the ADC Charge Pump On Control (CPON) bit to ‘0’.
None. |
None. |
ADC_ChargePumpEnable()
void ADC_ChargePumpEnable (void )
Sets the ADC Charge Pump On Control (CPON) bit to ‘1’.
None. |
None. |
ADC_ComputationModeSet()
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
computationMode |
Desired computation mode. Refer to the adc_computation_mode_t enum for the list of available computation modes. |
None. |
ADC_Context1ThresholdCallbackRegister()
void ADC_Context1ThresholdCallbackRegister (void(*)(void) callback)
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
*callback |
The pointer to the function to be executed |
None. |
ADC_Context1ThresholdInterruptDisable()
void ADC_Context1ThresholdInterruptDisable (void )
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to ‘0’ for ADC Context 1.
None. |
None. |
ADC_Context1ThresholdInterruptEnable()
void ADC_Context1ThresholdInterruptEnable (void )
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to ‘1’ for ADC Context 1.
None. |
None. |
ADC_Context1ThresholdInterruptFlagClear()
void ADC_Context1ThresholdInterruptFlagClear (void )
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to ‘0’ for ADC Context 1.
None. |
None. |
ADC_Context1ThresholdISR()
void ADC_Context1ThresholdISR (void )
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
None. |
None. |
ADC_Context2ThresholdCallbackRegister()
void ADC_Context2ThresholdCallbackRegister (void(*)(void) callback)
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
*callback |
The pointer to the function to be executed |
None. |
ADC_Context2ThresholdInterruptDisable()
void ADC_Context2ThresholdInterruptDisable (void )
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to ‘0’ for ADC Context 2.
None. |
None. |
ADC_Context2ThresholdInterruptEnable()
void ADC_Context2ThresholdInterruptEnable (void )
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to ‘1’ for ADC Context 2.
None. |
None. |
ADC_Context2ThresholdInterruptFlagClear()
void ADC_Context2ThresholdInterruptFlagClear (void )
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to ‘0’ for ADC Context 2.
None. |
None. |
ADC_Context2ThresholdISR()
void ADC_Context2ThresholdISR (void )
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
None. |
None. |
ADC_Context3ThresholdCallbackRegister()
void ADC_Context3ThresholdCallbackRegister (void(*)(void) callback)
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
*callback |
The pointer to the function to be executed |
None. |
ADC_Context3ThresholdInterruptDisable()
void ADC_Context3ThresholdInterruptDisable (void )
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to ‘0’ for ADC Context 3.
None. |
None. |
ADC_Context3ThresholdInterruptEnable()
void ADC_Context3ThresholdInterruptEnable (void )
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to ‘1’ for ADC Context 3.
None. |
None. |
ADC_Context3ThresholdInterruptFlagClear()
void ADC_Context3ThresholdInterruptFlagClear (void )
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to ‘0’ for ADC Context 3.
None. |
None. |
ADC_Context3ThresholdISR()
void ADC_Context3ThresholdISR (void )
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
None. |
None. |
ADC_Context4ThresholdCallbackRegister()
void ADC_Context4ThresholdCallbackRegister (void(*)(void) callback)
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
*callback |
The pointer to the function to be executed |
None. |
ADC_Context4ThresholdInterruptDisable()
void ADC_Context4ThresholdInterruptDisable (void )
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to ‘0’ for ADC Context 4.
None. |
None. |
ADC_Context4ThresholdInterruptEnable()
void ADC_Context4ThresholdInterruptEnable (void )
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to ‘1’ for ADC Context 4.
None. |
None. |
ADC_Context4ThresholdInterruptFlagClear()
void ADC_Context4ThresholdInterruptFlagClear (void )
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to ‘0’ for ADC Context 4.
None. |
None. |
ADC_Context4ThresholdISR()
void ADC_Context4ThresholdISR (void )
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
None. |
None. |
ADC_ContextSelect()
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
context |
Context to be selected. Refer to the adc_context_t enum for the list of available contexts. |
None. |
ADC_ContinuousConversionDisable()
void ADC_ContinuousConversionDisable (void )
Sets the Continuous Operation Enable (CONT) bit to ‘0’ for the current context.
None. |
None. |
ADC_ContinuousConversionEnable()
void ADC_ContinuousConversionEnable (void )
Sets the Continuous Operation Enable (CONT) bit to ‘1’ for the current context.
None. |
None. |
ADC_ConversionDoneCallbackRegister()
void ADC_ConversionDoneCallbackRegister (void(*)(void) callback)
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
Pointer |
The pointer to the function to be executed |
None. |
ADC_ConversionDoneInterruptDisable()
void ADC_ConversionDoneInterruptDisable (void )
Sets the ADC Interrupt Enable (ADIE) bit to 0.
None. |
None. |
ADC_ConversionDoneInterruptEnable()
void ADC_ConversionDoneInterruptEnable (void )
Sets the ADC Interrupt Enable (ADIE) bit to ‘1’.
None. |
None. |
ADC_ConversionDoneInterruptFlagClear()
void ADC_ConversionDoneInterruptFlagClear (void )
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to ‘0’.
None. |
None. |
ADC_ConversionResultGet()
adc_result_t ADC_ConversionResultGet (void )
Retrieves the result of the latest conversion for the current context.
Call ADC_ConversionStart(void) before using this API. |
None. |
adc_result_t - The result of the conversion |
ADC_ConversionStageStatusGet()
adc_conversion_stage_t ADC_ConversionStageStatusGet (void )
Retrieves the conversion stage status for the current context.
None. |
adc_conversion_stage_t - Stage of the conversion stages |
ADC_ConversionStart()
void ADC_ConversionStart (void )
Starts the conversion on a selected channel.
Select the channel(s) using ADC_ChannelSelect and call ADC_Initialize(void) to initialize the ADC module before using this API. |
None. |
None. |
ADC_ConversionStop()
void ADC_ConversionStop (void )
Stops the ongoing conversion.
None. |
None. |
ADC_CurrentContextGet()
adc_context_t ADC_CurrentContextGet (void )
Returns the current context number.
None. |
adc_context_t - Context selected. Refer to the adc_context_t enum for the list of available contexts. |
ADC_CurrentConversionCountGet()
adc_repeat_count_t ADC_CurrentConversionCountGet (void )
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
None. |
adc_repeat_count_t - Current value of the ADCNT register |
ADC_Deinitialize()
void ADC_Deinitialize (void )
Deinitializes the registers to power-on Reset values.
None. |
None. |
ADC_DifferentialChannelSelect()
void ADC_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion in the current context.
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. |
ADC_DifferentialChannelSelectAndConvert()
adc_result_t ADC_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels for the current context.
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 |
ADC_Disable()
void ADC_Disable (void )
Sets the ADC Enable (ON) bit to '0'.
None. |
None. |
ADC_DoubleSamplingDisable()
void ADC_DoubleSamplingDisable (void )
Sets the Double-Sample Enable (DSEN) bit to ‘0’ for the current context.
None. |
None. |
ADC_DoubleSamplingEnable()
void ADC_DoubleSamplingEnable (void )
Sets the Double-Sample Enable (DSEN) bit to ‘1’ for the current context.
None. |
None. |
ADC_Enable()
void ADC_Enable (void )
Sets the ADC Enable (ON) bit to ‘1’.
None. |
None. |
ADC_ErrorCalculationGet()
adc_result_t ADC_ErrorCalculationGet (void )
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
None. |
adc_result_t - Value obtained from the ADERR register |
ADC_ErrorCalculationModeSet()
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
errorCalculationMode |
Desired errorCalculationMode value. Refer to the adc_calculation_mode_t for the error calculation mode options. |
None. |
ADC_FilterValueGet()
adc_result_t ADC_FilterValueGet (void )
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
None. |
adc_result_t - Value obtained after the ADC Accumulator (ADACC) register is right shifted by the CRS bits. In Low-Pass Filter (LPF) mode, this is the output of the Low-Pass Filter. |
ADC_HasAccumulatorOverflowed()
bool ADC_HasAccumulatorOverflowed (void )
Determines whether the accumulator has overflowed for the current context.
None. |
True |
ADC accumulator has overflowed |
False |
ADC accumulator has not overflowed |
ADC_Initialize()
void ADC_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. |
ADC_IsAccumulatorClearComplete()
bool ADC_IsAccumulatorClearComplete (void )
Status of the accumulator clear operation for the current context.
None. |
True |
ADC accumulator clear operation complete |
False |
ADC accumulator clear operation not complete |
ADC_IsBusy()
bool ADC_IsBusy (void )
Returns the busy status of the ADC module.
None. |
True |
The ADC is in use |
False |
The ADC is not in use |
ADC_IsChargePumpReady()
bool ADC_IsChargePumpReady (void )
Checks the Charge Pump Ready status.
None. |
True |
Charge Pump is ready |
False |
Charge Pump is not ready |
ADC_IsContext1ThresholdInterruptFlagSet()
bool ADC_IsContext1ThresholdInterruptFlagSet (void )
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
None. |
True |
ADCH1IF flag is set |
False |
ADCH1IF flag is not set |
ADC_IsContext2ThresholdInterruptFlagSet()
bool ADC_IsContext2ThresholdInterruptFlagSet (void )
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
None. |
True |
ADCH2IF flag is set |
False |
ADCH2IF flag is not set |
ADC_IsContext3ThresholdInterruptFlagSet()
bool ADC_IsContext3ThresholdInterruptFlagSet (void )
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
None. |
True |
ADCH3IF flag is set |
False |
ADCH3IF flag is not set |
ADC_IsContext4ThresholdInterruptFlagSet()
bool ADC_IsContext4ThresholdInterruptFlagSet (void )
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
None. |
True |
ADCH4IF flag is set |
False |
ADCH4IF flag is not set |
ADC_IsConversionDone()
bool ADC_IsConversionDone (void )
Checks if the ongoing conversion is complete.
ADC_ConversionStart(void) is called before using this API. |
None. |
True |
Conversion is complete |
False |
Conversion is ongoing |
ADC_IsConversionDoneInterruptFlagSet()
bool ADC_IsConversionDoneInterruptFlagSet (void )
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
None. |
True |
ADI flag is set |
False |
ADI flag is not set |
ADC_IsErrorGreaterThanUpperThreshold()
bool ADC_IsErrorGreaterThanUpperThreshold (void )
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
None. |
True |
ADC error is greater than the upper threshold |
False |
ADC error is not greater than the upper threshold |
ADC_IsErrorLesserThanLowerThreshold()
bool ADC_IsErrorLesserThanLowerThreshold (void )
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
None. |
True |
ADC error is less than the lower threshold |
False |
ADC error is not less the lower threshold |
ADC_ISR()
void ADC_ISR (void )
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
None. |
None. |
ADC_IsThresholdInterruptFlagSet()
bool ADC_IsThresholdInterruptFlagSet (void )
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
None. |
True |
ADCHxIF flag is set |
False |
ADCHxIF flag is not set |
ADC_LowerThresholdSet()
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
lowerThreshold |
Lower threshold value of the adc_threshold_t type for the ADLTH register |
None. |
ADC_PrechargeTimeSet()
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
prechargeTime |
Value to be loaded in the ADPRE register |
None. |
ADC_PreviousResultGet()
adc_result_t ADC_PreviousResultGet (void )
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
None. |
adc_result_t - Value obtained from the ADPREV register |
ADC_ResolutionGet()
uint8_t ADC_ResolutionGet (void )
Returns the resolution of the ADC module.
None. |
uint8_t - Resolution value |
ADC_SampleCapacitorDischarge()
void ADC_SampleCapacitorDischarge (void )
Discharges the input sample capacitor by setting the channel to AVss for the current context.
None. |
None. |
ADC_SampleRepeatCountSet()
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
repeatCount |
Repeat count value. Refer to the adc_repeat_count_t type. |
None. |
ADC_SetPointDefine()
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
setPoint |
Value for the ADSTPT register of the adc_threshold_t type |
None. |
ADC_StopOnInterruptDisable()
void ADC_StopOnInterruptDisable (void )
Sets the Stop-on-Interrupt (SOI) bit to ‘0’ for the current context.
None. |
None. |
ADC_StopOnInterruptEnable()
void ADC_StopOnInterruptEnable (void )
Sets the Stop-on-Interrupt (SOI) bit to ‘1’ for the current context.
Call ADC_ContinuousConversionEnable API before using this API. Select the ADC context before calling this API using ADC_ContextSelect. |
None. |
None. |
ADC_Tasks()
void ADC_Tasks (void )
Implements the Tasks routine for the polling implementations.
None. |
None. |
ADC_ThresholdCallbackRegister()
void ADC_ThresholdCallbackRegister (void(*)(void) callback)
Sets the callback for the threshold interrupt of the current context.
*callback |
The pointer to the function to be executed |
None. |
ADC_ThresholdInterruptDisable()
void ADC_ThresholdInterruptDisable (void )
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to ‘0’ for the current context.
None. |
None. |
ADC_ThresholdInterruptEnable()
void ADC_ThresholdInterruptEnable (void )
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to ‘1’ for the current context.
None. |
None. |
ADC_ThresholdInterruptFlagClear()
void ADC_ThresholdInterruptFlagClear (void )
Clears the ADC Threshold Interrupt Flag bit to ‘0’ for the current context.
None. |
None. |
ADC_ThresholdModeSet()
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
thresholdMode |
Desired threshold mode. Refer to the adc_threshold_mode_t enum for the list of available threshold modes. |
None. |
ADC_UpperThresholdSet()
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
upperThreshold |
Upper threshold value of the adc_threshold_t type for the ADUTH register. |
None. |
Enumeration Type Documentation
adc_calculation_mode_t
enum adc_calculation_mode_t
ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT |
First derivative of single measurement |
ADC_ACTUAL_RESULT_VS_SETPOINT |
Actual result vs setpoint |
ADC_ACTUAL_RESULT_VS_FILTERED_VALUE |
Actual result vs filtered value |
ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE |
First derivative of filtered value |
ADC_FILTERED_VALUE_VS_SETPOINT |
Filtered value vs setpoint |
adc_channel_t
enum adc_channel_t
ADC_CHANNEL_VSS | |
ADC_CHANNEL_TEMP | |
ADC_CHANNEL_DAC1 | |
ADC_CHANNEL_FVR_BUFFER1 | |
ADC_CHANNEL_FVR_BUFFER2 | |
ADC_CHANNEL_ANA1 | |
ADC_CHANNEL_ANA2 | |
ADC_CHANNEL_ANA6 | |
ADC_CHANNEL_ANB2 | |
ADC_CHANNEL_ANB4 | |
ADC_CHANNEL_ANC1 |
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC |
Basic mode |
ADC_SERIES_ACCUMULATE |
Series Accumulate mode |
ADC_SERIES_AVERAGE |
Series Average mode |
ADC_BURST_AVERAGE |
Burst Average mode |
ADC_LOW_PASS_FILTER |
Low-Pass Filter mode |
adc_context_t
enum adc_context_t
context_1 | |
context_2 | |
context_3 | |
context_4 |
adc_conversion_stage_t
enum adc_conversion_stage_t
ADC_NOT_CONVERTING |
Not converting |
ADC_1ST_PRECHARGE |
1st precharge |
ADC_1ST_ACQUISITION |
1st acquisition |
ADC_1ST_CONVERSION |
1st conversion |
ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE |
Suspended between 1st and 2nd sample |
ADC_2ND_PRECHARGE |
2nd precharge |
ADC_2ND_ACQUISITION |
2nd acquisition |
ADC_2ND_CONVERSION |
2nd conversion |
adc_negChannel_t
enum adc_negChannel_t
ADC_NEGCHANNEL_ANA3 | |
ADC_NEGCHANNEL_VSS |
adc_posChannel_t
enum adc_posChannel_t
ADC_POSCHANNEL_ANA1 | |
ADC_POSCHANNEL_VSS |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT |
Disabled |
ADC_BELOW_LOWER_THRESHOLD |
ADERR < ADLTH |
ADC_ABOVE_LOWER_THRESHOLD |
ADERR >= ADLTH |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR > ADLTH and ADERR < ADUTH |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR < ADLTH or ADERR > ADUTH |
ADC_BELOW_UPPER_THRESHOLD |
ADERR <= ADUTH |
ADC_ABOVE_UPPER_THRESHOLD |
ADERR > ADUTH |
ADC_ALWAYS_INTERRUPT |
Enabled |
adc_trigger_source_t
enum adc_trigger_source_t
ADC_TRIGGER_SOURCE_DISABLED |
Disabled |
ADC_TRIGGER_SOURCE_ADACTPPS |
ADACTPPS |
ADC_TRIGGER_SOURCE_TMR0 |
TMR0 |
ADC_TRIGGER_SOURCE_TMR1 |
TMR1 |
ADC_TRIGGER_SOURCE_TMR2 |
TMR2 |
ADC_TRIGGER_SOURCE_TMR3 |
TMR3 |
ADC_TRIGGER_SOURCE_TMR4 |
TMR4 |
ADC_TRIGGER_SOURCE_TMR5 |
TMR5 |
ADC_TRIGGER_SOURCE_TMR6 |
TMR6 |
ADC_TRIGGER_SOURCE_SMT1_OVERFLOW |
SMT1_Overflow |
ADC_TRIGGER_SOURCE_CCP1 |
CCP1 |
ADC_TRIGGER_SOURCE_CCP2 |
CCP2 |
ADC_TRIGGER_SOURCE_CCP3 |
CCP3 |
ADC_TRIGGER_SOURCE_PWM1_OUT1 |
PWM1_OUT1 |
ADC_TRIGGER_SOURCE_PWM1_OUT2 |
PWM1_OUT2 |
ADC_TRIGGER_SOURCE_PWM2_OUT1 |
PWM2_OUT1 |
ADC_TRIGGER_SOURCE_PWM2_OUT2 |
PWM2_OUT2 |
ADC_TRIGGER_SOURCE_PWM3_OUT1 |
PWM3_OUT1 |
ADC_TRIGGER_SOURCE_PWM3_OUT2 |
PWM3_OUT2 |
ADC_TRIGGER_SOURCE_NCO1 |
NCO1 |
ADC_TRIGGER_SOURCE_NCO2 |
NCO2 |
ADC_TRIGGER_SOURCE_NCO3 |
NCO3 |
ADC_TRIGGER_SOURCE_CMP1 |
CMP1 |
ADC_TRIGGER_SOURCE_CMP2 |
CMP2 |
ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS |
Logical OR of all IOC flags |
ADC_TRIGGER_SOURCE_CLC1 |
CLC1 |
ADC_TRIGGER_SOURCE_CLC2 |
CLC2 |
ADC_TRIGGER_SOURCE_CLC3 |
CLC3 |
ADC_TRIGGER_SOURCE_CLC4 |
CLC4 |
ADC_TRIGGER_SOURCE_CLC5 |
CLC5 |
ADC_TRIGGER_SOURCE_CLC6 |
CLC6 |
ADC_TRIGGER_SOURCE_CLC7 |
CLC7 |
ADC_TRIGGER_SOURCE_CLC8 |
CLC8 |
ADC_TRIGGER_SOURCE_ADERRH |
ADERRH |
ADC_TRIGGER_SOURCE_ADRESH |
ADRESH |
ADC_TRIGGER_SOURCE_ADPCH |
ADPCH |
3.1.3.1.6 File Documentation
source/Channel-Grouping_Differential_Interrupts/adc/adc.h File Reference
#include <stdint.h> #include <stdbool.h> #include "./adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
-
void ADC_ConversionDoneInterruptEnable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '1'.
-
void ADC_ConversionDoneInterruptDisable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '0'.
-
void ADC_ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to '1' for the current context.
-
void ADC_ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to '0' for the current context.
-
void ADC_Context1ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '1' for ADC Context 1.
-
void ADC_Context1ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '1' for ADC Context 2.
-
void ADC_Context2ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '1' for ADC Context 3.
-
void ADC_Context3ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '1' for ADC Context 4.
-
void ADC_Context4ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '0' for ADC Context 4.
-
void ADC_ISR (void)
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
-
void ADC_Context1ThresholdISR (void)
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
-
void ADC_Context2ThresholdISR (void)
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
-
void ADC_Context3ThresholdISR (void)
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
-
void ADC_Context4ThresholdISR (void)
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
Detailed Description
ADC Generated Driver API Header File
source/Channel-Grouping_Differential_Tasks/adc/adc.h File Reference
#include <stdint.h> #include <stdbool.h> #include "./adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
void ADC_Tasks (void)
Implements the Tasks routine for the polling implementations.
Detailed Description
ADC Generated Driver API Header File
source/Channel-Grouping_Single-Ended_Interrupts/adc/adc.h File Reference
#include <stdint.h> #include <stdbool.h> #include "./adc_types.h"
Functions
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
void ADC_ConversionStop (void)
Stops the ongoing conversion.
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
void ADC_ConversionDoneInterruptEnable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '1'.
void ADC_ConversionDoneInterruptDisable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '0'.
void ADC_ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to '1' for the current context.
void ADC_ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to '0' for the current context.
void ADC_Context1ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '1' for ADC Context 1.
void ADC_Context1ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '0' for ADC Context 1.
void ADC_Context2ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '1' for ADC Context 2.
void ADC_Context2ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '0' for ADC Context 2.
void ADC_Context3ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '1' for ADC Context 3.
void ADC_Context3ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '0' for ADC Context 3.
void ADC_Context4ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '1' for ADC Context 4.
void ADC_Context4ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '0' for ADC Context 4.
void ADC_ISR (void)
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
void ADC_Context1ThresholdISR (void)
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
void ADC_Context2ThresholdISR (void)
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
void ADC_Context3ThresholdISR (void)
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
void ADC_Context4ThresholdISR (void)
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
Detailed Description
ADC Generated Driver API Header File
source/Channel-Grouping_Single-Ended_Tasks/adc/adc.h File Reference
#include <stdint.h> #include <stdbool.h> #include "./adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
void ADC_Tasks (void)
Implements the Tasks routine for the polling implementations.
Detailed Description
ADC Generated Driver API Header File
source/Charge-Pump_Single-Ended_Interrupts/adc/adc.h File Reference
#include <stdint.h> #include <stdbool.h> #include "./adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC_ChargePumpEnable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '1'.
void ADC_ChargePumpDisable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '0'.
bool ADC_IsChargePumpReady (void)
Checks the Charge Pump Ready status.
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
void ADC_ConversionDoneInterruptEnable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '1'.
void ADC_ConversionDoneInterruptDisable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '0'.
void ADC_ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to '1' for the current context.
void ADC_ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to '0' for the current context.
void ADC_Context1ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '1' for ADC Context 1.
void ADC_Context1ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '0' for ADC Context 1.
void ADC_Context2ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '1' for ADC Context 2.
void ADC_Context2ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '0' for ADC Context 2.
void ADC_Context3ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '1' for ADC Context 3.
void ADC_Context3ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '0' for ADC Context 3.
void ADC_Context4ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '1' for ADC Context 4.
void ADC_Context4ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '0' for ADC Context 4.
void ADC_ISR (void)
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
void ADC_Context1ThresholdISR (void)
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
void ADC_Context2ThresholdISR (void)
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
void ADC_Context3ThresholdISR (void)
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
void ADC_Context4ThresholdISR (void)
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
Detailed Description
ADC Generated Driver API Header File
source/Charge-Pump_Single-Ended_Tasks/adc/adc.h File Reference
#include <stdint.h> #include <stdbool.h> #include "./adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
void ADC_ConversionStop (void)
Stops the ongoing conversion.
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
void ADC_ChargePumpEnable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '1'.
void ADC_ChargePumpDisable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '0'.
bool ADC_IsChargePumpReady (void)
Checks the Charge Pump Ready status.
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
void ADC_Tasks (void)
Implements the Tasks routine for the polling implementations.
Detailed Description
ADC Generated Driver API Header File
source/Channel-Grouping_Differential_Interrupts/adc/adc_types.h File Reference
Macros
#define ADC_RESOLUTION 12
ADC resolution value.
#define ADC_BIT_SET 1
ADC bit set value.
#define ADC_BIT_CLEAR 0
ADC bit clear value.
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.
typedef uint8_t adc_repeat_count_t
ADC conversion repeat count type.
Enumerations
enum adc_posChannel_t { ADC_POSCHANNEL_ANA1 = 0x1 }
Enumeration in Differential mode that contains the available ADC positive channels.
enum adc_negChannel_t { ADC_NEGCHANNEL_ANA3 = 0x3, ADC_NEGCHANNEL_VSS = 0x3b }
Enumeration in Differential mode that contains the available ADC negative channels.
enum adc_computation_mode_t { ADC_BASIC = 0x0, ADC_SERIES_ACCUMULATE = 0x1, ADC_SERIES_AVERAGE = 0x2, ADC_BURST_AVERAGE = 0x3, ADC_LOW_PASS_FILTER = 0x4 }
Enumeration for the ADC computation modes.
enum adc_calculation_mode_t { ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5, ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5 }
Enumeration for the ADC error calculation modes.
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_LOWER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4, ADC_BELOW_UPPER_THRESHOLD = 0x5, ADC_ABOVE_UPPER_THRESHOLD = 0x6, ADC_ALWAYS_INTERRUPT = 0x7 }
Enumeration for the ADC threshold modes.
enum adc_trigger_source_t { ADC_TRIGGER_SOURCE_DISABLED = 0x0, ADC_TRIGGER_SOURCE_ADACTPPS = 0x1, ADC_TRIGGER_SOURCE_TMR0 = 0x2, ADC_TRIGGER_SOURCE_TMR1 = 0x3, ADC_TRIGGER_SOURCE_TMR2 = 0x4, ADC_TRIGGER_SOURCE_TMR3 = 0x5, ADC_TRIGGER_SOURCE_TMR4 = 0x6, ADC_TRIGGER_SOURCE_TMR5 = 0x7, ADC_TRIGGER_SOURCE_TMR6 = 0x8, ADC_TRIGGER_SOURCE_SMT1_OVERFLOW = 0xe, ADC_TRIGGER_SOURCE_CCP1 = 0xf, ADC_TRIGGER_SOURCE_CCP2 = 0x10, ADC_TRIGGER_SOURCE_CCP3 = 0x11, ADC_TRIGGER_SOURCE_PWM1_OUT1 = 0x12, ADC_TRIGGER_SOURCE_PWM1_OUT2 = 0x13, ADC_TRIGGER_SOURCE_PWM2_OUT1 = 0x14, ADC_TRIGGER_SOURCE_PWM2_OUT2 = 0x15, ADC_TRIGGER_SOURCE_PWM3_OUT1 = 0x16, ADC_TRIGGER_SOURCE_PWM3_OUT2 = 0x17, ADC_TRIGGER_SOURCE_NCO1 = 0x1a, ADC_TRIGGER_SOURCE_NCO2 = 0x1b, ADC_TRIGGER_SOURCE_NCO3 = 0x1c, ADC_TRIGGER_SOURCE_CMP1 = 0x1d, ADC_TRIGGER_SOURCE_CMP2 = 0x1e, ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS = 0x1f, ADC_TRIGGER_SOURCE_CLC1 = 0x20, ADC_TRIGGER_SOURCE_CLC2 = 0x21, ADC_TRIGGER_SOURCE_CLC3 = 0x22, ADC_TRIGGER_SOURCE_CLC4 = 0x23, ADC_TRIGGER_SOURCE_CLC5 = 0x24, ADC_TRIGGER_SOURCE_CLC6 = 0x25, ADC_TRIGGER_SOURCE_CLC7 = 0x26, ADC_TRIGGER_SOURCE_CLC8 = 0x27, ADC_TRIGGER_SOURCE_ADERRH = 0x3d, ADC_TRIGGER_SOURCE_ADRESH = 0x3e, ADC_TRIGGER_SOURCE_ADPCH = 0x3f }
Enumeration for the ADC auto-trigger sources.
enum adc_conversion_stage_t { ADC_NOT_CONVERTING = 0x0, ADC_1ST_PRECHARGE = 0x1, ADC_1ST_ACQUISITION = 0x2, ADC_1ST_CONVERSION = 0x3, ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE = 0x4, ADC_2ND_PRECHARGE = 0x5, ADC_2ND_ACQUISITION = 0x6, ADC_2ND_CONVERSION = 0x7 }
Enumeration for the ADC conversion stage statuses.
enum adc_context_t { context_1 = 0, context_2 = 1, context_3 = 2, context_4 = 3 }
Contains the available ADC contexts.
Detailed Description
ADC Type Definitions Header File
source/Channel-Grouping_Differential_Tasks/adc/adc_types.h File Reference
Macros
#define ADC_RESOLUTION 12
ADC resolution value.
#define ADC_BIT_SET 1
ADC bit set value.
#define ADC_BIT_CLEAR 0
ADC bit clear value.
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
typedef uint8_t adc_repeat_count_t
Enumerations
enum adc_posChannel_t { ADC_POSCHANNEL_ANA1 = 0x1, ADC_POSCHANNEL_VSS = 0x3b }
enum adc_negChannel_t { ADC_NEGCHANNEL_ANA3 = 0x3, ADC_NEGCHANNEL_VSS = 0x3b }
enum adc_computation_mode_t { ADC_BASIC = 0x0, ADC_SERIES_ACCUMULATE = 0x1, ADC_SERIES_AVERAGE = 0x2, ADC_BURST_AVERAGE = 0x3, ADC_LOW_PASS_FILTER = 0x4 }
enum adc_calculation_mode_t { ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_LOWER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4, ADC_BELOW_UPPER_THRESHOLD = 0x5, ADC_ABOVE_UPPER_THRESHOLD = 0x6, ADC_ALWAYS_INTERRUPT = 0x7 }
enum adc_trigger_source_t { ADC_TRIGGER_SOURCE_DISABLED = 0x0, ADC_TRIGGER_SOURCE_ADACTPPS = 0x1, ADC_TRIGGER_SOURCE_TMR0 = 0x2, ADC_TRIGGER_SOURCE_TMR1 = 0x3, ADC_TRIGGER_SOURCE_TMR2 = 0x4, ADC_TRIGGER_SOURCE_TMR3 = 0x5, ADC_TRIGGER_SOURCE_TMR4 = 0x6, ADC_TRIGGER_SOURCE_TMR5 = 0x7, ADC_TRIGGER_SOURCE_TMR6 = 0x8, ADC_TRIGGER_SOURCE_SMT1_OVERFLOW = 0xe, ADC_TRIGGER_SOURCE_CCP1 = 0xf, ADC_TRIGGER_SOURCE_CCP2 = 0x10, ADC_TRIGGER_SOURCE_CCP3 = 0x11, ADC_TRIGGER_SOURCE_PWM1_OUT1 = 0x12, ADC_TRIGGER_SOURCE_PWM1_OUT2 = 0x13, ADC_TRIGGER_SOURCE_PWM2_OUT1 = 0x14, ADC_TRIGGER_SOURCE_PWM2_OUT2 = 0x15, ADC_TRIGGER_SOURCE_PWM3_OUT1 = 0x16, ADC_TRIGGER_SOURCE_PWM3_OUT2 = 0x17, ADC_TRIGGER_SOURCE_NCO1 = 0x1a, ADC_TRIGGER_SOURCE_NCO2 = 0x1b, ADC_TRIGGER_SOURCE_NCO3 = 0x1c, ADC_TRIGGER_SOURCE_CMP1 = 0x1d, ADC_TRIGGER_SOURCE_CMP2 = 0x1e, ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS = 0x1f, ADC_TRIGGER_SOURCE_CLC1 = 0x20, ADC_TRIGGER_SOURCE_CLC2 = 0x21, ADC_TRIGGER_SOURCE_CLC3 = 0x22, ADC_TRIGGER_SOURCE_CLC4 = 0x23, ADC_TRIGGER_SOURCE_CLC5 = 0x24, ADC_TRIGGER_SOURCE_CLC6 = 0x25, ADC_TRIGGER_SOURCE_CLC7 = 0x26, ADC_TRIGGER_SOURCE_CLC8 = 0x27, ADC_TRIGGER_SOURCE_ADERRH = 0x3d, ADC_TRIGGER_SOURCE_ADRESH = 0x3e, ADC_TRIGGER_SOURCE_ADPCH = 0x3f }
enum adc_conversion_stage_t { ADC_NOT_CONVERTING = 0x0, ADC_1ST_PRECHARGE = 0x1, ADC_1ST_ACQUISITION = 0x2, ADC_1ST_CONVERSION = 0x3, ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE = 0x4, ADC_2ND_PRECHARGE = 0x5, ADC_2ND_ACQUISITION = 0x6, ADC_2ND_CONVERSION = 0x7 }
enum adc_context_t { context_1 = 0, context_2 = 1, context_3 = 2, context_4 = 3 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_repeat_count_t
typedef uint8_t adc_repeat_count_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_calculation_mode_t
enum adc_calculation_mode_t
ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT |
First derivative of single measurement |
ADC_ACTUAL_RESULT_VS_SETPOINT |
Actual result vs setpoint |
ADC_ACTUAL_RESULT_VS_FILTERED_VALUE |
Actual result vs filtered value |
ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE |
First derivative of filtered value |
ADC_FILTERED_VALUE_VS_SETPOINT |
Filtered value vs setpoint |
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC |
Basic mode |
ADC_SERIES_ACCUMULATE |
Series Accumulate mode |
ADC_SERIES_AVERAGE |
Series Average mode |
ADC_BURST_AVERAGE |
Burst Average mode |
ADC_LOW_PASS_FILTER |
Low-Pass Filter mode |
ADC_BASIC |
Basic mode |
ADC_SERIES_ACCUMULATE |
Series Accumulate mode |
ADC_SERIES_AVERAGE |
Series Average mode |
ADC_BURST_AVERAGE |
Burst Average mode |
ADC_LOW_PASS_FILTER |
Low-Pass Filter mode |
adc_context_t
enum adc_context_t
context_1 | |
context_2 | |
context_3 | |
context_4 |
adc_conversion_stage_t
enum adc_conversion_stage_t
ADC_NOT_CONVERTING |
Not converting |
ADC_1ST_PRECHARGE |
1st precharge |
ADC_1ST_ACQUISITION |
1st acquisition |
ADC_1ST_CONVERSION |
1st conversion |
ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE |
Suspended between 1st and 2nd sample |
ADC_2ND_PRECHARGE |
2nd precharge |
ADC_2ND_ACQUISITION |
2nd acquisition |
ADC_2ND_CONVERSION |
2nd conversion |
adc_negChannel_t
enum adc_negChannel_t
ADC_NEGCHANNEL_ANA3 | |
ADC_NEGCHANNEL_VSS |
adc_posChannel_t
enum adc_posChannel_t
ADC_POSCHANNEL_ANA1 | |
ADC_POSCHANNEL_VSS |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT |
Disabled |
ADC_BELOW_LOWER_THRESHOLD |
ADERR < ADLTH |
ADC_ABOVE_LOWER_THRESHOLD |
ADERR >= ADLTH |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR > ADLTH and ADERR < ADUTH |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR < ADLTH or ADERR > ADUTH |
ADC_BELOW_UPPER_THRESHOLD |
ADERR <= ADUTH |
ADC_ABOVE_UPPER_THRESHOLD |
ADERR > ADUTH |
ADC_ALWAYS_INTERRUPT |
Enabled |
adc_trigger_source_t
enum adc_trigger_source_t
ADC_TRIGGER_SOURCE_DISABLED |
Disabled |
ADC_TRIGGER_SOURCE_ADACTPPS |
ADACTPPS |
ADC_TRIGGER_SOURCE_TMR0 |
TMR0 |
ADC_TRIGGER_SOURCE_TMR1 |
TMR1 |
ADC_TRIGGER_SOURCE_TMR2 |
TMR2 |
ADC_TRIGGER_SOURCE_TMR3 |
TMR3 |
ADC_TRIGGER_SOURCE_TMR4 |
TMR4 |
ADC_TRIGGER_SOURCE_TMR5 |
TMR5 |
ADC_TRIGGER_SOURCE_TMR6 |
TMR6 |
ADC_TRIGGER_SOURCE_SMT1_OVERFLOW |
SMT1_Overflow |
ADC_TRIGGER_SOURCE_CCP1 |
CCP1 |
ADC_TRIGGER_SOURCE_CCP2 |
CCP2 |
ADC_TRIGGER_SOURCE_CCP3 |
CCP3 |
ADC_TRIGGER_SOURCE_PWM1_OUT1 |
PWM1_OUT1 |
ADC_TRIGGER_SOURCE_PWM1_OUT2 |
PWM1_OUT2 |
ADC_TRIGGER_SOURCE_PWM2_OUT1 |
PWM2_OUT1 |
ADC_TRIGGER_SOURCE_PWM2_OUT2 |
PWM2_OUT2 |
ADC_TRIGGER_SOURCE_PWM3_OUT1 |
PWM3_OUT1 |
ADC_TRIGGER_SOURCE_PWM3_OUT2 |
PWM3_OUT2 |
ADC_TRIGGER_SOURCE_NCO1 |
NCO1 |
ADC_TRIGGER_SOURCE_NCO2 |
NCO2 |
ADC_TRIGGER_SOURCE_NCO3 |
NCO3 |
ADC_TRIGGER_SOURCE_CMP1 |
CMP1 |
ADC_TRIGGER_SOURCE_CMP2 |
CMP2 |
ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS |
Logical OR of all IOC flags |
ADC_TRIGGER_SOURCE_CLC1 |
CLC1 |
ADC_TRIGGER_SOURCE_CLC2 |
CLC2 |
ADC_TRIGGER_SOURCE_CLC3 |
CLC3 |
ADC_TRIGGER_SOURCE_CLC4 |
CLC4 |
ADC_TRIGGER_SOURCE_CLC5 |
CLC5 |
ADC_TRIGGER_SOURCE_CLC6 |
CLC6 |
ADC_TRIGGER_SOURCE_CLC7 |
CLC7 |
ADC_TRIGGER_SOURCE_CLC8 |
CLC8 |
ADC_TRIGGER_SOURCE_ADERRH |
ADERRH |
ADC_TRIGGER_SOURCE_ADRESH |
ADRESH |
ADC_TRIGGER_SOURCE_ADPCH |
ADPCH |
source/Channel-Grouping_Single-Ended_Interrupts/adc/adc_types.h File Reference
Macros
#define ADC_RESOLUTION 12
ADC resolution value.
#define ADC_BIT_SET 1
ADC bit set value.
#define ADC_BIT_CLEAR 0
ADC bit clear value.
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
typedef uint8_t adc_repeat_count_t
Enumerations
enum adc_channel_t { ADC_CHANNEL_VSS = 0x3b, ADC_CHANNEL_TEMP = 0x3c, ADC_CHANNEL_DAC1 = 0x3d, ADC_CHANNEL_FVR_BUFFER1 = 0x3e, ADC_CHANNEL_FVR_BUFFER2 = 0x3f, ADC_CHANNEL_ANA1 = 0x1, ADC_CHANNEL_ANA2 = 0x2, ADC_CHANNEL_ANA6 = 0x6, ADC_CHANNEL_ANB2 = 0xa, ADC_CHANNEL_ANB4 = 0xc, ADC_CHANNEL_ANC1 = 0x11}
Enumeration in Single-Ended mode that describes the available ADC channels.
enum adc_computation_mode_t { ADC_BASIC = 0x0, ADC_SERIES_ACCUMULATE = 0x1, ADC_SERIES_AVERAGE = 0x2, ADC_BURST_AVERAGE = 0x3, ADC_LOW_PASS_FILTER = 0x4 }
enum adc_calculation_mode_t { ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_LOWER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4, ADC_BELOW_UPPER_THRESHOLD = 0x5, ADC_ABOVE_UPPER_THRESHOLD = 0x6, ADC_ALWAYS_INTERRUPT = 0x7 }
enum adc_trigger_source_t { ADC_TRIGGER_SOURCE_DISABLED = 0x0, ADC_TRIGGER_SOURCE_ADACTPPS = 0x1, ADC_TRIGGER_SOURCE_TMR0 = 0x2, ADC_TRIGGER_SOURCE_TMR1 = 0x3, ADC_TRIGGER_SOURCE_TMR2 = 0x4, ADC_TRIGGER_SOURCE_TMR3 = 0x5, ADC_TRIGGER_SOURCE_TMR4 = 0x6, ADC_TRIGGER_SOURCE_TMR5 = 0x7, ADC_TRIGGER_SOURCE_TMR6 = 0x8, ADC_TRIGGER_SOURCE_SMT1_OVERFLOW = 0xe, ADC_TRIGGER_SOURCE_CCP1 = 0xf, ADC_TRIGGER_SOURCE_CCP2 = 0x10, ADC_TRIGGER_SOURCE_CCP3 = 0x11, ADC_TRIGGER_SOURCE_PWM1_OUT1 = 0x12, ADC_TRIGGER_SOURCE_PWM1_OUT2 = 0x13, ADC_TRIGGER_SOURCE_PWM2_OUT1 = 0x14, ADC_TRIGGER_SOURCE_PWM2_OUT2 = 0x15, ADC_TRIGGER_SOURCE_PWM3_OUT1 = 0x16, ADC_TRIGGER_SOURCE_PWM3_OUT2 = 0x17, ADC_TRIGGER_SOURCE_NCO1 = 0x1a, ADC_TRIGGER_SOURCE_NCO2 = 0x1b, ADC_TRIGGER_SOURCE_NCO3 = 0x1c, ADC_TRIGGER_SOURCE_CMP1 = 0x1d, ADC_TRIGGER_SOURCE_CMP2 = 0x1e, ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS = 0x1f, ADC_TRIGGER_SOURCE_CLC1 = 0x20, ADC_TRIGGER_SOURCE_CLC2 = 0x21, ADC_TRIGGER_SOURCE_CLC3 = 0x22, ADC_TRIGGER_SOURCE_CLC4 = 0x23, ADC_TRIGGER_SOURCE_CLC5 = 0x24, ADC_TRIGGER_SOURCE_CLC6 = 0x25, ADC_TRIGGER_SOURCE_CLC7 = 0x26, ADC_TRIGGER_SOURCE_CLC8 = 0x27, ADC_TRIGGER_SOURCE_ADERRH = 0x3d, ADC_TRIGGER_SOURCE_ADRESH = 0x3e, ADC_TRIGGER_SOURCE_ADPCH = 0x3f }
enum adc_conversion_stage_t { ADC_NOT_CONVERTING = 0x0, ADC_1ST_PRECHARGE = 0x1, ADC_1ST_ACQUISITION = 0x2, ADC_1ST_CONVERSION = 0x3, ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE = 0x4, ADC_2ND_PRECHARGE = 0x5, ADC_2ND_ACQUISITION = 0x6, ADC_2ND_CONVERSION = 0x7 }
enum adc_context_t { context_1 = 0, context_2 = 1, context_3 = 2, context_4 = 3 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_repeat_count_t
typedef uint8_t adc_repeat_count_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_calculation_mode_t
enum adc_calculation_mode_t
ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT |
First derivative of single measurement |
ADC_ACTUAL_RESULT_VS_SETPOINT |
Actual result vs setpoint |
ADC_ACTUAL_RESULT_VS_FILTERED_VALUE |
Actual result vs filtered value |
ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE |
First derivative of filtered value |
ADC_FILTERED_VALUE_VS_SETPOINT |
Filtered value vs setpoint |
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC |
Basic mode |
ADC_SERIES_ACCUMULATE |
Series Accumulate mode |
ADC_SERIES_AVERAGE |
Series Average mode |
ADC_BURST_AVERAGE |
Burst Average mode |
ADC_LOW_PASS_FILTER |
Low-Pass Filter mode |
adc_context_t
enum adc_context_t
context_1 | |
context_2 | |
context_3 | |
context_4 |
adc_conversion_stage_t
enum adc_conversion_stage_t
ADC_NOT_CONVERTING |
Not converting |
ADC_1ST_PRECHARGE |
1st precharge |
ADC_1ST_ACQUISITION |
1st acquisition |
ADC_1ST_CONVERSION |
1st conversion |
ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE |
Suspended between 1st and 2nd sample |
ADC_2ND_PRECHARGE |
2nd precharge |
ADC_2ND_ACQUISITION |
2nd acquisition |
ADC_2ND_CONVERSION |
2nd conversion |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT |
Disabled |
ADC_BELOW_LOWER_THRESHOLD |
ADERR < ADLTH |
ADC_ABOVE_LOWER_THRESHOLD |
ADERR >= ADLTH |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR > ADLTH and ADERR < ADUTH |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR < ADLTH or ADERR > ADUTH |
ADC_BELOW_UPPER_THRESHOLD |
ADERR <= ADUTH |
ADC_ABOVE_UPPER_THRESHOLD |
ADERR > ADUTH |
ADC_ALWAYS_INTERRUPT |
Enabled |
adc_trigger_source_t
enum adc_trigger_source_t
ADC_TRIGGER_SOURCE_DISABLED |
Disabled |
ADC_TRIGGER_SOURCE_ADACTPPS |
ADACTPPS |
ADC_TRIGGER_SOURCE_TMR0 |
TMR0 |
ADC_TRIGGER_SOURCE_TMR1 |
TMR1 |
ADC_TRIGGER_SOURCE_TMR2 |
TMR2 |
ADC_TRIGGER_SOURCE_TMR3 |
TMR3 |
ADC_TRIGGER_SOURCE_TMR4 |
TMR4 |
ADC_TRIGGER_SOURCE_TMR5 |
TMR5 |
ADC_TRIGGER_SOURCE_TMR6 |
TMR6 |
ADC_TRIGGER_SOURCE_SMT1_OVERFLOW |
SMT1_Overflow |
ADC_TRIGGER_SOURCE_CCP1 |
CCP1 |
ADC_TRIGGER_SOURCE_CCP2 |
CCP2 |
ADC_TRIGGER_SOURCE_CCP3 |
CCP3 |
ADC_TRIGGER_SOURCE_PWM1_OUT1 |
PWM1_OUT1 |
ADC_TRIGGER_SOURCE_PWM1_OUT2 |
PWM1_OUT2 |
ADC_TRIGGER_SOURCE_PWM2_OUT1 |
PWM2_OUT1 |
ADC_TRIGGER_SOURCE_PWM2_OUT2 |
PWM2_OUT2 |
ADC_TRIGGER_SOURCE_PWM3_OUT1 |
PWM3_OUT1 |
ADC_TRIGGER_SOURCE_PWM3_OUT2 |
PWM3_OUT2 |
ADC_TRIGGER_SOURCE_NCO1 |
NCO1 |
ADC_TRIGGER_SOURCE_NCO2 |
NCO2 |
ADC_TRIGGER_SOURCE_NCO3 |
NCO3 |
ADC_TRIGGER_SOURCE_CMP1 |
CMP1 |
ADC_TRIGGER_SOURCE_CMP2 |
CMP2 |
ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS |
Logical OR of all IOC flags |
ADC_TRIGGER_SOURCE_CLC1 |
CLC1 |
ADC_TRIGGER_SOURCE_CLC2 |
CLC2 |
ADC_TRIGGER_SOURCE_CLC3 |
CLC3 |
ADC_TRIGGER_SOURCE_CLC4 |
CLC4 |
ADC_TRIGGER_SOURCE_CLC5 |
CLC5 |
ADC_TRIGGER_SOURCE_CLC6 |
CLC6 |
ADC_TRIGGER_SOURCE_CLC7 |
CLC7 |
ADC_TRIGGER_SOURCE_CLC8 |
CLC8 |
ADC_TRIGGER_SOURCE_ADERRH |
ADERRH |
ADC_TRIGGER_SOURCE_ADRESH |
ADRESH |
ADC_TRIGGER_SOURCE_ADPCH |
ADPCH |
source/Channel-Grouping_Single-Ended_Tasks/adc/adc_types.h File Reference
Macros
#define ADC_RESOLUTION 12
ADC resolution value.
#define ADC_BIT_SET 1
ADC bit set value.
#define ADC_BIT_CLEAR 0
ADC bit clear value.
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
typedef uint8_t adc_repeat_count_t
Enumerations
enum adc_channel_t { ADC_CHANNEL_VSS = 0x3b, ADC_CHANNEL_TEMP = 0x3c, ADC_CHANNEL_DAC1 = 0x3d, ADC_CHANNEL_FVR_BUFFER1 = 0x3e, ADC_CHANNEL_FVR_BUFFER2 = 0x3f, ADC_CHANNEL_ANA1 = 0x1, ADC_CHANNEL_ANA2 = 0x2, ADC_CHANNEL_ANA6 = 0x6, ADC_CHANNEL_ANB2 = 0xa, ADC_CHANNEL_ANB4 = 0xc, ADC_CHANNEL_ANC1 = 0x11 }
enum adc_computation_mode_t { ADC_BASIC = 0x0, ADC_SERIES_ACCUMULATE = 0x1, ADC_SERIES_AVERAGE = 0x2, ADC_BURST_AVERAGE = 0x3, ADC_LOW_PASS_FILTER = 0x4 }
enum adc_calculation_mode_t { ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_LOWER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4, ADC_BELOW_UPPER_THRESHOLD = 0x5, ADC_ABOVE_UPPER_THRESHOLD = 0x6, ADC_ALWAYS_INTERRUPT = 0x7 }
enum adc_trigger_source_t { ADC_TRIGGER_SOURCE_DISABLED = 0x0, ADC_TRIGGER_SOURCE_ADACTPPS = 0x1, ADC_TRIGGER_SOURCE_TMR0 = 0x2, ADC_TRIGGER_SOURCE_TMR1 = 0x3, ADC_TRIGGER_SOURCE_TMR2 = 0x4, ADC_TRIGGER_SOURCE_TMR3 = 0x5, ADC_TRIGGER_SOURCE_TMR4 = 0x6, ADC_TRIGGER_SOURCE_TMR5 = 0x7, ADC_TRIGGER_SOURCE_TMR6 = 0x8, ADC_TRIGGER_SOURCE_SMT1_OVERFLOW = 0xe, ADC_TRIGGER_SOURCE_CCP1 = 0xf, ADC_TRIGGER_SOURCE_CCP2 = 0x10, ADC_TRIGGER_SOURCE_CCP3 = 0x11, ADC_TRIGGER_SOURCE_PWM1_OUT1 = 0x12, ADC_TRIGGER_SOURCE_PWM1_OUT2 = 0x13, ADC_TRIGGER_SOURCE_PWM2_OUT1 = 0x14, ADC_TRIGGER_SOURCE_PWM2_OUT2 = 0x15, ADC_TRIGGER_SOURCE_PWM3_OUT1 = 0x16, ADC_TRIGGER_SOURCE_PWM3_OUT2 = 0x17, ADC_TRIGGER_SOURCE_NCO1 = 0x1a, ADC_TRIGGER_SOURCE_NCO2 = 0x1b, ADC_TRIGGER_SOURCE_NCO3 = 0x1c, ADC_TRIGGER_SOURCE_CMP1 = 0x1d, ADC_TRIGGER_SOURCE_CMP2 = 0x1e, ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS = 0x1f, ADC_TRIGGER_SOURCE_CLC1 = 0x20, ADC_TRIGGER_SOURCE_CLC2 = 0x21, ADC_TRIGGER_SOURCE_CLC3 = 0x22, ADC_TRIGGER_SOURCE_CLC4 = 0x23, ADC_TRIGGER_SOURCE_CLC5 = 0x24, ADC_TRIGGER_SOURCE_CLC6 = 0x25, ADC_TRIGGER_SOURCE_CLC7 = 0x26, ADC_TRIGGER_SOURCE_CLC8 = 0x27, ADC_TRIGGER_SOURCE_ADERRH = 0x3d, ADC_TRIGGER_SOURCE_ADRESH = 0x3e, ADC_TRIGGER_SOURCE_ADPCH = 0x3f }
enum adc_conversion_stage_t { ADC_NOT_CONVERTING = 0x0, ADC_1ST_PRECHARGE = 0x1, ADC_1ST_ACQUISITION = 0x2, ADC_1ST_CONVERSION = 0x3, ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE = 0x4, ADC_2ND_PRECHARGE = 0x5, ADC_2ND_ACQUISITION = 0x6, ADC_2ND_CONVERSION = 0x7 }
enum adc_context_t { context_1 = 0, context_2 = 1, context_3 = 2, context_4 = 3 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_repeat_count_t
typedef uint8_t adc_repeat_count_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_calculation_mode_t
enum adc_calculation_mode_t
ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT |
First derivative of single measurement |
ADC_ACTUAL_RESULT_VS_SETPOINT |
Actual result vs setpoint |
ADC_ACTUAL_RESULT_VS_FILTERED_VALUE |
Actual result vs filtered value |
ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE |
First derivative of filtered value |
ADC_FILTERED_VALUE_VS_SETPOINT |
Filtered value vs setpoint |
adc_channel_t
enum adc_channel_t
ADC_CHANNEL_VSS | |
ADC_CHANNEL_TEMP | |
ADC_CHANNEL_DAC1 | |
ADC_CHANNEL_FVR_BUFFER1 | |
ADC_CHANNEL_FVR_BUFFER2 | |
ADC_CHANNEL_ANA1 | |
ADC_CHANNEL_ANA2 | |
ADC_CHANNEL_ANA6 | |
ADC_CHANNEL_ANB2 | |
ADC_CHANNEL_ANB4 | |
ADC_CHANNEL_ANC1 |
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC |
Basic mode |
ADC_SERIES_ACCUMULATE |
Series Accumulate mode |
ADC_SERIES_AVERAGE |
Series Average mode |
ADC_BURST_AVERAGE |
Burst Average mode |
ADC_LOW_PASS_FILTER |
Low-Pass Filter mode |
adc_context_t
enum adc_context_t
context_1 | |
context_2 | |
context_3 | |
context_4 |
adc_conversion_stage_t
enum adc_conversion_stage_t
ADC_NOT_CONVERTING |
Not converting |
ADC_1ST_PRECHARGE |
1st precharge |
ADC_1ST_ACQUISITION |
1st acquisition |
ADC_1ST_CONVERSION |
1st conversion |
ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE |
Suspended between 1st and 2nd sample |
ADC_2ND_PRECHARGE |
2nd precharge |
ADC_2ND_ACQUISITION |
2nd acquisition |
ADC_2ND_CONVERSION |
2nd conversion |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT |
Disabled |
ADC_BELOW_LOWER_THRESHOLD |
ADERR < ADLTH |
ADC_ABOVE_LOWER_THRESHOLD |
ADERR >= ADLTH |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR > ADLTH and ADERR < ADUTH |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR < ADLTH or ADERR > ADUTH |
ADC_BELOW_UPPER_THRESHOLD |
ADERR <= ADUTH |
ADC_ABOVE_UPPER_THRESHOLD |
ADERR > ADUTH |
ADC_ALWAYS_INTERRUPT |
Enabled |
adc_trigger_source_t
enum adc_trigger_source_t
ADC_TRIGGER_SOURCE_DISABLED |
Disabled |
ADC_TRIGGER_SOURCE_ADACTPPS |
ADACTPPS |
ADC_TRIGGER_SOURCE_TMR0 |
TMR0 |
ADC_TRIGGER_SOURCE_TMR1 |
TMR1 |
ADC_TRIGGER_SOURCE_TMR2 |
TMR2 |
ADC_TRIGGER_SOURCE_TMR3 |
TMR3 |
ADC_TRIGGER_SOURCE_TMR4 |
TMR4 |
ADC_TRIGGER_SOURCE_TMR5 |
TMR5 |
ADC_TRIGGER_SOURCE_TMR6 |
TMR6 |
ADC_TRIGGER_SOURCE_SMT1_OVERFLOW |
SMT1_Overflow |
ADC_TRIGGER_SOURCE_CCP1 |
CCP1 |
ADC_TRIGGER_SOURCE_CCP2 |
CCP2 |
ADC_TRIGGER_SOURCE_CCP3 |
CCP3 |
ADC_TRIGGER_SOURCE_PWM1_OUT1 |
PWM1_OUT1 |
ADC_TRIGGER_SOURCE_PWM1_OUT2 |
PWM1_OUT2 |
ADC_TRIGGER_SOURCE_PWM2_OUT1 |
PWM2_OUT1 |
ADC_TRIGGER_SOURCE_PWM2_OUT2 |
PWM2_OUT2 |
ADC_TRIGGER_SOURCE_PWM3_OUT1 |
PWM3_OUT1 |
ADC_TRIGGER_SOURCE_PWM3_OUT2 |
PWM3_OUT2 |
ADC_TRIGGER_SOURCE_NCO1 |
NCO1 |
ADC_TRIGGER_SOURCE_NCO2 |
NCO2 |
ADC_TRIGGER_SOURCE_NCO3 |
NCO3 |
ADC_TRIGGER_SOURCE_CMP1 |
CMP1 |
ADC_TRIGGER_SOURCE_CMP2 |
CMP2 |
ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS |
Logical OR of all IOC flags |
ADC_TRIGGER_SOURCE_CLC1 |
CLC1 |
ADC_TRIGGER_SOURCE_CLC2 |
CLC2 |
ADC_TRIGGER_SOURCE_CLC3 |
CLC3 |
ADC_TRIGGER_SOURCE_CLC4 |
CLC4 |
ADC_TRIGGER_SOURCE_CLC5 |
CLC5 |
ADC_TRIGGER_SOURCE_CLC6 |
CLC6 |
ADC_TRIGGER_SOURCE_CLC7 |
CLC7 |
ADC_TRIGGER_SOURCE_CLC8 |
CLC8 |
ADC_TRIGGER_SOURCE_ADERRH |
ADERRH |
ADC_TRIGGER_SOURCE_ADRESH |
ADRESH |
ADC_TRIGGER_SOURCE_ADPCH |
ADPCH |
source/Charge-Pump_Single-Ended_Interrupts/adc/adc_types.h File Reference
Macros
#define ADC_RESOLUTION 12
ADC resolution value.
#define ADC_BIT_SET 1
ADC bit set value.
#define ADC_BIT_CLEAR 0
ADC bit clear value.
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
typedef uint8_t adc_repeat_count_t
Enumerations
enum adc_channel_t { ADC_CHANNEL_VSS = 0x3b, ADC_CHANNEL_TEMP = 0x3c, ADC_CHANNEL_DAC1 = 0x3d, ADC_CHANNEL_FVR_BUFFER1 = 0x3e, ADC_CHANNEL_FVR_BUFFER2 = 0x3f, ADC_CHANNEL_ANA1 = 0x1, ADC_CHANNEL_ANA2 = 0x2, ADC_CHANNEL_ANA6 = 0x6, ADC_CHANNEL_ANB2 = 0xa, ADC_CHANNEL_ANB4 = 0xc, ADC_CHANNEL_ANC1 = 0x11 }
enum adc_computation_mode_t { ADC_BASIC = 0x0, ADC_SERIES_ACCUMULATE = 0x1, ADC_SERIES_AVERAGE = 0x2, ADC_BURST_AVERAGE = 0x3, ADC_LOW_PASS_FILTER = 0x4 }
enum adc_calculation_mode_t { ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_LOWER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4, ADC_BELOW_UPPER_THRESHOLD = 0x5, ADC_ABOVE_UPPER_THRESHOLD = 0x6, ADC_ALWAYS_INTERRUPT = 0x7 }
enum adc_trigger_source_t { ADC_TRIGGER_SOURCE_DISABLED = 0x0, ADC_TRIGGER_SOURCE_ADACTPPS = 0x1, ADC_TRIGGER_SOURCE_TMR0 = 0x2, ADC_TRIGGER_SOURCE_TMR1 = 0x3, ADC_TRIGGER_SOURCE_TMR2 = 0x4, ADC_TRIGGER_SOURCE_TMR3 = 0x5, ADC_TRIGGER_SOURCE_TMR4 = 0x6, ADC_TRIGGER_SOURCE_TMR5 = 0x7, ADC_TRIGGER_SOURCE_TMR6 = 0x8, ADC_TRIGGER_SOURCE_SMT1_OVERFLOW = 0xe, ADC_TRIGGER_SOURCE_CCP1 = 0xf, ADC_TRIGGER_SOURCE_CCP2 = 0x10, ADC_TRIGGER_SOURCE_CCP3 = 0x11, ADC_TRIGGER_SOURCE_PWM1_OUT1 = 0x12, ADC_TRIGGER_SOURCE_PWM1_OUT2 = 0x13, ADC_TRIGGER_SOURCE_PWM2_OUT1 = 0x14, ADC_TRIGGER_SOURCE_PWM2_OUT2 = 0x15, ADC_TRIGGER_SOURCE_PWM3_OUT1 = 0x16, ADC_TRIGGER_SOURCE_PWM3_OUT2 = 0x17, ADC_TRIGGER_SOURCE_NCO1 = 0x1a, ADC_TRIGGER_SOURCE_NCO2 = 0x1b, ADC_TRIGGER_SOURCE_NCO3 = 0x1c, ADC_TRIGGER_SOURCE_CMP1 = 0x1d, ADC_TRIGGER_SOURCE_CMP2 = 0x1e, ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS = 0x1f, ADC_TRIGGER_SOURCE_CLC1 = 0x20, ADC_TRIGGER_SOURCE_CLC2 = 0x21, ADC_TRIGGER_SOURCE_CLC3 = 0x22, ADC_TRIGGER_SOURCE_CLC4 = 0x23, ADC_TRIGGER_SOURCE_CLC5 = 0x24, ADC_TRIGGER_SOURCE_CLC6 = 0x25, ADC_TRIGGER_SOURCE_CLC7 = 0x26, ADC_TRIGGER_SOURCE_CLC8 = 0x27, ADC_TRIGGER_SOURCE_ADERRH = 0x3d, ADC_TRIGGER_SOURCE_ADRESH = 0x3e, ADC_TRIGGER_SOURCE_ADPCH = 0x3f }
enum adc_conversion_stage_t { ADC_NOT_CONVERTING = 0x0, ADC_1ST_PRECHARGE = 0x1, ADC_1ST_ACQUISITION = 0x2, ADC_1ST_CONVERSION = 0x3, ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE = 0x4, ADC_2ND_PRECHARGE = 0x5, ADC_2ND_ACQUISITION = 0x6, ADC_2ND_CONVERSION = 0x7 }
enum adc_context_t { context_1 = 0, context_2 = 1, context_3 = 2, context_4 = 3 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_repeat_count_t
typedef uint8_t adc_repeat_count_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_calculation_mode_t
enum adc_calculation_mode_t
ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT |
First derivative of single measurement |
ADC_ACTUAL_RESULT_VS_SETPOINT |
Actual result vs setpoint |
ADC_ACTUAL_RESULT_VS_FILTERED_VALUE |
Actual result vs filtered value |
ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE |
First derivative of filtered value |
ADC_FILTERED_VALUE_VS_SETPOINT |
Filtered value vs setpoint |
adc_channel_t
enum adc_channel_t
ADC_CHANNEL_VSS | |
ADC_CHANNEL_TEMP | |
ADC_CHANNEL_DAC1 | |
ADC_CHANNEL_FVR_BUFFER1 | |
ADC_CHANNEL_FVR_BUFFER2 | |
ADC_CHANNEL_ANA1 | |
ADC_CHANNEL_ANA2 | |
ADC_CHANNEL_ANA6 | |
ADC_CHANNEL_ANB2 | |
ADC_CHANNEL_ANB4 | |
ADC_CHANNEL_ANC1 |
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC |
Basic mode |
ADC_SERIES_ACCUMULATE |
Series Accumulate mode |
ADC_SERIES_AVERAGE |
Series Average mode |
ADC_BURST_AVERAGE |
Burst Average mode |
ADC_LOW_PASS_FILTER |
Low-Pass Filter mode |
adc_context_t
enum adc_context_t
context_1 | |
context_2 | |
context_3 | |
context_4 |
adc_conversion_stage_t
enum adc_conversion_stage_t
ADC_NOT_CONVERTING |
Not converting |
ADC_1ST_PRECHARGE |
1st precharge |
ADC_1ST_ACQUISITION |
1st acquisition |
ADC_1ST_CONVERSION |
1st conversion |
ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE |
Suspended between 1st and 2nd sample |
ADC_2ND_PRECHARGE |
2nd precharge |
ADC_2ND_ACQUISITION |
2nd acquisition |
ADC_2ND_CONVERSION |
2nd conversion |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT |
Disabled |
ADC_BELOW_LOWER_THRESHOLD |
ADERR < ADLTH |
ADC_ABOVE_LOWER_THRESHOLD |
ADERR >= ADLTH |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR > ADLTH and ADERR < ADUTH |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR < ADLTH or ADERR > ADUTH |
ADC_BELOW_UPPER_THRESHOLD |
ADERR <= ADUTH |
ADC_ABOVE_UPPER_THRESHOLD |
ADERR > ADUTH |
ADC_ALWAYS_INTERRUPT |
Enabled |
adc_trigger_source_t
enum adc_trigger_source_t
ADC_TRIGGER_SOURCE_DISABLED |
Disabled |
ADC_TRIGGER_SOURCE_ADACTPPS |
ADACTPPS |
ADC_TRIGGER_SOURCE_TMR0 |
TMR0 |
ADC_TRIGGER_SOURCE_TMR1 |
TMR1 |
ADC_TRIGGER_SOURCE_TMR2 |
TMR2 |
ADC_TRIGGER_SOURCE_TMR3 |
TMR3 |
ADC_TRIGGER_SOURCE_TMR4 |
TMR4 |
ADC_TRIGGER_SOURCE_TMR5 |
TMR5 |
ADC_TRIGGER_SOURCE_TMR6 |
TMR6 |
ADC_TRIGGER_SOURCE_SMT1_OVERFLOW |
SMT1_Overflow |
ADC_TRIGGER_SOURCE_CCP1 |
CCP1 |
ADC_TRIGGER_SOURCE_CCP2 |
CCP2 |
ADC_TRIGGER_SOURCE_CCP3 |
CCP3 |
ADC_TRIGGER_SOURCE_PWM1_OUT1 |
PWM1_OUT1 |
ADC_TRIGGER_SOURCE_PWM1_OUT2 |
PWM1_OUT2 |
ADC_TRIGGER_SOURCE_PWM2_OUT1 |
PWM2_OUT1 |
ADC_TRIGGER_SOURCE_PWM2_OUT2 |
PWM2_OUT2 |
ADC_TRIGGER_SOURCE_PWM3_OUT1 |
PWM3_OUT1 |
ADC_TRIGGER_SOURCE_PWM3_OUT2 |
PWM3_OUT2 |
ADC_TRIGGER_SOURCE_NCO1 |
NCO1 |
ADC_TRIGGER_SOURCE_NCO2 |
NCO2 |
ADC_TRIGGER_SOURCE_NCO3 |
NCO3 |
ADC_TRIGGER_SOURCE_CMP1 |
CMP1 |
ADC_TRIGGER_SOURCE_CMP2 |
CMP2 |
ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS |
Logical OR of all IOC flags |
ADC_TRIGGER_SOURCE_CLC1 |
CLC1 |
ADC_TRIGGER_SOURCE_CLC2 |
CLC2 |
ADC_TRIGGER_SOURCE_CLC3 |
CLC3 |
ADC_TRIGGER_SOURCE_CLC4 |
CLC4 |
ADC_TRIGGER_SOURCE_CLC5 |
CLC5 |
ADC_TRIGGER_SOURCE_CLC6 |
CLC6 |
ADC_TRIGGER_SOURCE_CLC7 |
CLC7 |
ADC_TRIGGER_SOURCE_CLC8 |
CLC8 |
ADC_TRIGGER_SOURCE_ADERRH |
ADERRH |
ADC_TRIGGER_SOURCE_ADRESH |
ADRESH |
ADC_TRIGGER_SOURCE_ADPCH |
ADPCH |
source/Charge-Pump_Single-Ended_Tasks/adc/adc_types.h File Reference
Macros
#define ADC_RESOLUTION 12
ADC resolution value.
#define ADC_BIT_SET 1
ADC bit set value.
#define ADC_BIT_CLEAR 0
ADC bit clear value.
Typedefs
typedef int16_t adc_result_t
typedef int32_t adc_accumulate_t
typedef int16_t adc_threshold_t
typedef uint8_t adc_repeat_count_t
Enumerations
enum adc_channel_t { ADC_CHANNEL_VSS = 0x3b, ADC_CHANNEL_TEMP = 0x3c, ADC_CHANNEL_DAC1 = 0x3d, ADC_CHANNEL_FVR_BUFFER1 = 0x3e, ADC_CHANNEL_FVR_BUFFER2 = 0x3f, ADC_CHANNEL_ANA1 = 0x1, ADC_CHANNEL_ANA2 = 0x2, ADC_CHANNEL_ANA6 = 0x6, ADC_CHANNEL_ANB2 = 0xa, ADC_CHANNEL_ANB4 = 0xc, ADC_CHANNEL_ANC1 = 0x11 }
enum adc_computation_mode_t { ADC_BASIC = 0x0, ADC_SERIES_ACCUMULATE = 0x1, ADC_SERIES_AVERAGE = 0x2, ADC_BURST_AVERAGE = 0x3, ADC_LOW_PASS_FILTER = 0x44 }
enum adc_calculation_mode_t { ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT = 0x0, ADC_ACTUAL_RESULT_VS_SETPOINT = 0x1, ADC_ACTUAL_RESULT_VS_FILTERED_VALUE = 0x2, ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE = 0x4, ADC_FILTERED_VALUE_VS_SETPOINT = 0x5 }
enum adc_threshold_mode_t { ADC_NEVER_INTERRUPT = 0x0, ADC_BELOW_LOWER_THRESHOLD = 0x1, ADC_ABOVE_LOWER_THRESHOLD = 0x2, ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD = 0x3, ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD = 0x4, ADC_BELOW_UPPER_THRESHOLD = 0x5, ADC_ABOVE_UPPER_THRESHOLD = 0x6, ADC_ALWAYS_INTERRUPT = 0x7 }
enum adc_trigger_source_t { ADC_TRIGGER_SOURCE_DISABLED = 0x0, ADC_TRIGGER_SOURCE_ADACTPPS = 0x1, ADC_TRIGGER_SOURCE_TMR0 = 0x2, ADC_TRIGGER_SOURCE_TMR1 = 0x3, ADC_TRIGGER_SOURCE_TMR2 = 0x4, ADC_TRIGGER_SOURCE_TMR3 = 0x5, ADC_TRIGGER_SOURCE_TMR4 = 0x6, ADC_TRIGGER_SOURCE_TMR5 = 0x7, ADC_TRIGGER_SOURCE_TMR6 = 0x8, ADC_TRIGGER_SOURCE_SMT1_OVERFLOW = 0xe, ADC_TRIGGER_SOURCE_CCP1 = 0xf, ADC_TRIGGER_SOURCE_CCP2 = 0x10, ADC_TRIGGER_SOURCE_CCP3 = 0x11, ADC_TRIGGER_SOURCE_PWM1_OUT1 = 0x12, ADC_TRIGGER_SOURCE_PWM1_OUT2 = 0x13, ADC_TRIGGER_SOURCE_PWM2_OUT1 = 0x14, ADC_TRIGGER_SOURCE_PWM2_OUT2 = 0x15, ADC_TRIGGER_SOURCE_PWM3_OUT1 = 0x16, ADC_TRIGGER_SOURCE_PWM3_OUT2 = 0x17, ADC_TRIGGER_SOURCE_NCO1 = 0x1a, ADC_TRIGGER_SOURCE_NCO2 = 0x1b, ADC_TRIGGER_SOURCE_NCO3 = 0x1c, ADC_TRIGGER_SOURCE_CMP1 = 0x1d, ADC_TRIGGER_SOURCE_CMP2 = 0x1e, ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS = 0x1f, ADC_TRIGGER_SOURCE_CLC1 = 0x20, ADC_TRIGGER_SOURCE_CLC2 = 0x21, ADC_TRIGGER_SOURCE_CLC3 = 0x22, ADC_TRIGGER_SOURCE_CLC4 = 0x23, ADC_TRIGGER_SOURCE_CLC5 = 0x24, ADC_TRIGGER_SOURCE_CLC6 = 0x25, ADC_TRIGGER_SOURCE_CLC7 = 0x26, ADC_TRIGGER_SOURCE_CLC8 = 0x27, ADC_TRIGGER_SOURCE_ADERRH = 0x3d, ADC_TRIGGER_SOURCE_ADRESH = 0x3e, ADC_TRIGGER_SOURCE_ADPCH = 0x3f }
enum adc_conversion_stage_t { ADC_NOT_CONVERTING = 0x0, ADC_1ST_PRECHARGE = 0x1, ADC_1ST_ACQUISITION = 0x2, ADC_1ST_CONVERSION = 0x3, ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE = 0x4, ADC_2ND_PRECHARGE = 0x5, ADC_2ND_ACQUISITION = 0x6, ADC_2ND_CONVERSION = 0x7 }
enum adc_context_t { context_1 = 0, context_2 = 1, context_3 = 2, context_4 = 3 }
Detailed Description
ADC Type Definitions Header File
Typedef Documentation
adc_accumulate_t
typedef int32_t adc_accumulate_t
adc_repeat_count_t
typedef uint8_t adc_repeat_count_t
adc_result_t
typedef int16_t adc_result_t
adc_threshold_t
typedef int16_t adc_threshold_t
Enumeration Type Documentation
adc_calculation_mode_t
enum adc_calculation_mode_t
ADC_FIRST_DERIVATIVE_OF_SINGLE_MEASUREMENT |
First derivative of single measurement |
ADC_ACTUAL_RESULT_VS_SETPOINT |
Actual result vs setpoint |
ADC_ACTUAL_RESULT_VS_FILTERED_VALUE |
Actual result vs filtered value |
ADC_FIRST_DERIVATIVE_OF_FILTERED_VALUE |
First derivative of filtered value |
ADC_FILTERED_VALUE_VS_SETPOINT |
Filtered value vs setpoint |
adc_channel_t
enum adc_channel_t
ADC_CHANNEL_VSS | |
ADC_CHANNEL_TEMP | |
ADC_CHANNEL_DAC1 | |
ADC_CHANNEL_FVR_BUFFER1 | |
ADC_CHANNEL_FVR_BUFFER2 | |
ADC_CHANNEL_ANA1 | |
ADC_CHANNEL_ANA2 | |
ADC_CHANNEL_ANA6 | |
ADC_CHANNEL_ANB2 | |
ADC_CHANNEL_ANB4 | |
ADC_CHANNEL_ANC1 |
adc_computation_mode_t
enum adc_computation_mode_t
ADC_BASIC |
Basic mode |
ADC_SERIES_ACCUMULATE |
Series Accumulate mode |
ADC_SERIES_AVERAGE |
Series Average mode |
ADC_BURST_AVERAGE |
Burst Average mode |
ADC_LOW_PASS_FILTER |
Low-Pass Filter mode |
adc_context_t
enum adc_context_t
context_1 | |
context_2 | |
context_3 | |
context_4 |
adc_conversion_stage_t
enum adc_conversion_stage_t
ADC_NOT_CONVERTING |
Not converting |
ADC_1ST_PRECHARGE |
1st precharge |
ADC_1ST_ACQUISITION |
1st acquisition |
ADC_1ST_CONVERSION |
1st conversion |
ADC_SUSPENDED_BETWEEN_1ST_AND_2ND_SAMPLE |
Suspended between 1st and 2nd sample |
ADC_2ND_PRECHARGE |
2nd precharge |
ADC_2ND_ACQUISITION |
2nd acquisition |
ADC_2ND_CONVERSION |
2nd conversion |
adc_threshold_mode_t
enum adc_threshold_mode_t
ADC_NEVER_INTERRUPT |
Disabled |
ADC_BELOW_LOWER_THRESHOLD |
ADERR < ADLTH |
ADC_ABOVE_LOWER_THRESHOLD |
ADERR >= ADLTH |
ADC_INSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR > ADLTH and ADERR < ADUTH |
ADC_OUTSIDE_LOWER_AND_UPPER_THRESHOLD |
ADERR < ADLTH or ADERR > ADUTH |
ADC_BELOW_UPPER_THRESHOLD |
ADERR <= ADUTH |
ADC_ABOVE_UPPER_THRESHOLD |
ADERR > ADUTH |
ADC_ALWAYS_INTERRUPT |
Enabled |
adc_trigger_source_t
enum adc_trigger_source_t
ADC_TRIGGER_SOURCE_DISABLED |
Disabled |
ADC_TRIGGER_SOURCE_ADACTPPS |
ADACTPPS |
ADC_TRIGGER_SOURCE_TMR0 |
TMR0 |
ADC_TRIGGER_SOURCE_TMR1 |
TMR1 |
ADC_TRIGGER_SOURCE_TMR2 |
TMR2 |
ADC_TRIGGER_SOURCE_TMR3 |
TMR3 |
ADC_TRIGGER_SOURCE_TMR4 |
TMR4 |
ADC_TRIGGER_SOURCE_TMR5 |
TMR5 |
ADC_TRIGGER_SOURCE_TMR6 |
TMR6 |
ADC_TRIGGER_SOURCE_SMT1_OVERFLOW |
SMT1_Overflow |
ADC_TRIGGER_SOURCE_CCP1 |
CCP1 |
ADC_TRIGGER_SOURCE_CCP2 |
CCP2 |
ADC_TRIGGER_SOURCE_CCP3 |
CCP3 |
ADC_TRIGGER_SOURCE_PWM1_OUT1 |
PWM1_OUT1 |
ADC_TRIGGER_SOURCE_PWM1_OUT2 |
PWM1_OUT2 |
ADC_TRIGGER_SOURCE_PWM2_OUT1 |
PWM2_OUT1 |
ADC_TRIGGER_SOURCE_PWM2_OUT2 |
PWM2_OUT2 |
ADC_TRIGGER_SOURCE_PWM3_OUT1 |
PWM3_OUT1 |
ADC_TRIGGER_SOURCE_PWM3_OUT2 |
PWM3_OUT2 |
ADC_TRIGGER_SOURCE_NCO1 |
NCO1 |
ADC_TRIGGER_SOURCE_NCO2 |
NCO2 |
ADC_TRIGGER_SOURCE_NCO3 |
NCO3 |
ADC_TRIGGER_SOURCE_CMP1 |
CMP1 |
ADC_TRIGGER_SOURCE_CMP2 |
CMP2 |
ADC_TRIGGER_SOURCE_LOGICAL_OR_OF_ALL_IOC_FLAGS |
Logical OR of all IOC flags |
ADC_TRIGGER_SOURCE_CLC1 |
CLC1 |
ADC_TRIGGER_SOURCE_CLC2 |
CLC2 |
ADC_TRIGGER_SOURCE_CLC3 |
CLC3 |
ADC_TRIGGER_SOURCE_CLC4 |
CLC4 |
ADC_TRIGGER_SOURCE_CLC5 |
CLC5 |
ADC_TRIGGER_SOURCE_CLC6 |
CLC6 |
ADC_TRIGGER_SOURCE_CLC7 |
CLC7 |
ADC_TRIGGER_SOURCE_CLC8 |
CLC8 |
ADC_TRIGGER_SOURCE_ADERRH |
ADERRH |
ADC_TRIGGER_SOURCE_ADRESH |
ADRESH |
ADC_TRIGGER_SOURCE_ADPCH |
ADPCH |
source/Channel-Grouping_Differential_Interrupts/adc/src/adc.c File Reference
This file contains the API implementations for the ADC driver.
#include <xc.h> #include "../adc.h" #include "../adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
-
void ADC_ConversionDoneInterruptEnable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '1'.
-
void ADC_ConversionDoneInterruptDisable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '0'.
-
void ADC_ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to '1' for the current context.
-
void ADC_ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to '0' for the current context.
-
void ADC_Context1ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '1' for ADC Context 1.
-
void ADC_Context1ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '1' for ADC Context 2.
-
void ADC_Context2ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '1' for ADC Context 3.
-
void ADC_Context3ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '1' for ADC Context 4.
-
void ADC_Context4ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '0' for ADC Context 4.
-
void ADC_ISR (void)
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
-
void ADC_Context1ThresholdISR (void)
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
-
void ADC_Context2ThresholdISR (void)
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
-
void ADC_Context3ThresholdISR (void)
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
-
void ADC_Context4ThresholdISR (void)
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
Variables
static bool adc_busy_status
static void(* ADC_ConversionDoneCallback )(void)
static void(* ADC_Context1ThresholdCallback )(void)
static void(* ADC_Context2ThresholdCallback )(void)
static void(* ADC_Context3ThresholdCallback )(void)
static void(* ADC_Context4ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC driver.
ADC Generated Driver File
Variable Documentation
adc_busy_status
bool adc_busy_status[static]
ADC_Context1ThresholdCallback
void(* ADC_Context1ThresholdCallback) (void)[static]
ADC_Context2ThresholdCallback
void(* ADC_Context2ThresholdCallback) (void)[static]
ADC_Context3ThresholdCallback
void(* ADC_Context3ThresholdCallback) (void)[static]
ADC_Context4ThresholdCallback
void(* ADC_Context4ThresholdCallback) (void)[static]
ADC_ConversionDoneCallback
void(* ADC_ConversionDoneCallback) (void)[static]
source/Channel-Grouping_Differential_Tasks/adc/src/adc.c File Reference
This file contains the API implementations for the ADC driver.
#include <xc.h> #include "../adc.h" #include "../adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_DifferentialChannelSelect (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Sets the positive and negative channels to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_DifferentialChannelSelectAndConvert (adc_posChannel_t posChannel, adc_negChannel_t negChannel)
Starts the conversion and retrieves the result of one conversion on the selected channels for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
-
void ADC_Tasks (void)
Implements the Tasks routine for the polling implementations.
Variables
static bool adc_busy_status
static void(* ADC_ConversionDoneCallback )(void)
static void(* ADC_Context1ThresholdCallback )(void)
static void(* ADC_Context2ThresholdCallback )(void)
static void(* ADC_Context3ThresholdCallback )(void)
static void(* ADC_Context4ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC driver.
ADC Generated Driver File
Variable Documentation
adc_busy_status
bool adc_busy_status[static]
ADC_Context1ThresholdCallback
void(* ADC_Context1ThresholdCallback) (void)[static]
ADC_Context2ThresholdCallback
void(* ADC_Context2ThresholdCallback) (void)[static]
ADC_Context3ThresholdCallback
void(* ADC_Context3ThresholdCallback) (void)[static]
ADC_Context4ThresholdCallback
void(* ADC_Context4ThresholdCallback) (void)[static]
ADC_ConversionDoneCallback
void(* ADC_ConversionDoneCallback) (void)[static]
source/Channel-Grouping_Single-Ended_Interrupts/adc/src/adc.c File Reference
This file contains the API implementations for the ADC driver.
#include <xc.h> #include "../adc.h" #include "../adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
-
void ADC_ConversionDoneInterruptEnable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '1'.
-
void ADC_ConversionDoneInterruptDisable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '0'.
-
void ADC_ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to '1' for the current context.
-
void ADC_ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to '0' for the current context.
-
void ADC_Context1ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '1' for ADC Context 1.
-
void ADC_Context1ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '1' for ADC Context 2.
-
void ADC_Context2ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '1' for ADC Context 3.
-
void ADC_Context3ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '1' for ADC Context 4.
-
void ADC_Context4ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '0' for ADC Context 4.
-
void ADC_ISR (void)
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
-
void ADC_Context1ThresholdISR (void)
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
-
void ADC_Context2ThresholdISR (void)
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
-
void ADC_Context3ThresholdISR (void)
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
-
void ADC_Context4ThresholdISR (void)
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
Variables
static bool adc_busy_status
static void(* ADC_ConversionDoneCallback )(void)
static void(* ADC_Context1ThresholdCallback )(void)
static void(* ADC_Context2ThresholdCallback )(void)
static void(* ADC_Context3ThresholdCallback )(void)
static void(* ADC_Context4ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC driver.
ADC Generated Driver File
Variable Documentation
adc_busy_status
bool adc_busy_status[static]
ADC_Context1ThresholdCallback
void(* ADC_Context1ThresholdCallback) (void)[static]
ADC_Context2ThresholdCallback
void(* ADC_Context2ThresholdCallback) (void)[static]
ADC_Context3ThresholdCallback
void(* ADC_Context3ThresholdCallback) (void)[static]
ADC_Context4ThresholdCallback
void(* ADC_Context4ThresholdCallback) (void)[static]
ADC_ConversionDoneCallback
void(* ADC_ConversionDoneCallback) (void)[static]
source/Channel-Grouping_Single-Ended_Tasks/adc/src/adc.c File Reference
This file contains the API implementations for the ADC driver.
#include <xc.h> #include "../adc.h" #include "../adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
-
void ADC_Tasks (void)
Implements the Tasks routine for the polling implementations.
Variables
static bool adc_busy_status
static void(* ADC_ConversionDoneCallback )(void)
static void(* ADC_Context1ThresholdCallback )(void)
static void(* ADC_Context2ThresholdCallback )(void)
static void(* ADC_Context3ThresholdCallback )(void)
static void(* ADC_Context4ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC driver.
ADC Generated Driver File
Variable Documentation
adc_busy_status
bool adc_busy_status[static]
ADC_Context1ThresholdCallback
void(* ADC_Context1ThresholdCallback) (void)[static]
ADC_Context2ThresholdCallback
void(* ADC_Context2ThresholdCallback) (void)[static]
ADC_Context3ThresholdCallback
void(* ADC_Context3ThresholdCallback) (void)[static]
ADC_Context4ThresholdCallback
void(* ADC_Context4ThresholdCallback) (void)[static]
ADC_ConversionDoneCallback
void(* ADC_ConversionDoneCallback) (void)[static]
source/Charge-Pump_Single-Ended_Interrupts/adc/src/adc.c File Reference
This file contains the API implementations for the ADC driver.
#include <xc.h> #include "../adc.h" #include "../adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
void ADC_ChargePumpEnable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '1'.
-
void ADC_ChargePumpDisable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '0'.
-
bool ADC_IsChargePumpReady (void)
Checks the Charge Pump Ready status.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
-
void ADC_ConversionDoneInterruptEnable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '1'.
-
void ADC_ConversionDoneInterruptDisable (void)
Sets the ADC Interrupt Enable (ADIE) bit to '0'.
-
void ADC_ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADHxIE) bit to '1' for the current context.
-
void ADC_ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Disable (ADHxIE) bit to '0' for the current context.
-
void ADC_Context1ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '1' for ADC Context 1.
-
void ADC_Context1ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH1IE) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '1' for ADC Context 2.
-
void ADC_Context2ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH2IE) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '1' for ADC Context 3.
-
void ADC_Context3ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH3IE) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptEnable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '1' for ADC Context 4.
-
void ADC_Context4ThresholdInterruptDisable (void)
Sets the ADC Threshold Interrupt Enable (ADCH4IE) bit to '0' for ADC Context 4.
-
void ADC_ISR (void)
Implements the ADC Conversion Done Interrupt (ADI) service routine for the interrupt-driven implementations.
-
void ADC_Context1ThresholdISR (void)
Implements the ADC Context 1 Threshold Interrupt (ADCH1) service routine for the interrupt-driven implementations.
-
void ADC_Context2ThresholdISR (void)
Implements the ADC Context 2 Threshold Interrupt (ADCH2) service routine for the interrupt-driven implementations.
-
void ADC_Context3ThresholdISR (void)
Implements the ADC Context 3 Threshold Interrupt (ADCH3) service routine for the interrupt-driven implementations.
-
void ADC_Context4ThresholdISR (void)
Implements the ADC Context 4 Threshold Interrupt (ADCH4) service routine for the interrupt-driven implementations.
Variables
static bool adc_busy_status
static void(* ADC_ConversionDoneCallback )(void)
static void(* ADC_Context1ThresholdCallback )(void)
static void(* ADC_Context2ThresholdCallback )(void)
static void(* ADC_Context3ThresholdCallback )(void)
static void(* ADC_Context4ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC driver.
ADC Generated Driver File
Variable Documentation
adc_busy_status
bool adc_busy_status[static]
ADC_Context1ThresholdCallback
void(* ADC_Context1ThresholdCallback) (void)[static]
ADC_Context2ThresholdCallback
void(* ADC_Context2ThresholdCallback) (void)[static]
ADC_Context3ThresholdCallback
void(* ADC_Context3ThresholdCallback) (void)[static]
ADC_Context4ThresholdCallback
void(* ADC_Context4ThresholdCallback) (void)[static]
ADC_ConversionDoneCallback
void(* ADC_ConversionDoneCallback) (void)[static]
source/Charge-Pump_Single-Ended_Tasks/adc/src/adc.c File Reference
This file contains the API implementations for the ADC driver.
#include <xc.h> #include "../adc.h" #include "../adc_types.h"
Functions
-
void ADC_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 ADC_Deinitialize (void)
Deinitializes the registers to power-on Reset values.
-
void ADC_Enable (void)
Sets the ADC Enable (ON) bit to '1'.
-
void ADC_Disable (void)
Sets the ADC Enable (ON) bit to '0'.
-
void ADC_ContextSelect (adc_context_t context)
Selects an ADC context to perform read/write operations on context-specific registers.
-
adc_context_t ADC_CurrentContextGet (void)
Returns the current context number.
-
void ADC_ChannelSelect (adc_channel_t channel)
Sets the channel to use for the ADC conversion in the current context.
-
void ADC_ConversionStart (void)
Starts the conversion on a selected channel.
-
bool ADC_IsConversionDone (void)
Checks if the ongoing conversion is complete.
-
void ADC_ConversionStop (void)
Stops the ongoing conversion.
-
adc_result_t ADC_ConversionResultGet (void)
Retrieves the result of the latest conversion for the current context.
-
void ADC_ComputationModeSet (adc_computation_mode_t computationMode)
Sets the computation mode for the current context.
-
void ADC_ThresholdModeSet (adc_threshold_mode_t thresholdMode)
Sets the conversion threshold mode for the current context.
-
void ADC_SampleRepeatCountSet (adc_repeat_count_t repeatCount)
Loads the repeat counter with the specified value for the current context.
-
void ADC_UpperThresholdSet (adc_threshold_t upperThreshold)
Sets the value of the ADC Upper Threshold (ADUTH) register for the current context.
-
void ADC_LowerThresholdSet (adc_threshold_t lowerThreshold)
Sets the value of the ADC Lower Threshold (ADLTH) register for the current context.
-
adc_accumulate_t ADC_AccumulatedResultGet (void)
Retrieves the value of the accumulated conversions for the current context.
-
adc_result_t ADC_ChannelSelectAndConvert (adc_channel_t channel)
Starts the conversion and retrieves the result of the single conversion on the selected channel for the current context.
-
void ADC_StopOnInterruptEnable (void)
Sets the Stop-on-Interrupt (SOI) bit to '1' for the current context.
-
void ADC_StopOnInterruptDisable (void)
Sets the Stop-on-Interrupt (SOI) bit to '0' for the current context.
-
void ADC_SampleCapacitorDischarge (void)
Discharges the input sample capacitor by setting the channel to AVss for the current context.
-
void ADC_AcquisitionTimeSet (uint16_t acquisitionValue)
Sets the specified value for the ADC Acquisition Time Control (ADACQ) register for the current context.
-
void ADC_PrechargeTimeSet (uint16_t prechargeTime)
Sets the specified value for the ADC Precharge Time Control (ADPRE) register for the current context.
-
adc_repeat_count_t ADC_CurrentConversionCountGet (void)
Retrieves the current value of the ADC Repeat Counter (ADCNT) register for the current context.
-
void ADC_AccumulatorClear (void)
Clears the accumulator for the current context.
-
bool ADC_IsAccumulatorClearComplete (void)
Status of the accumulator clear operation for the current context.
-
bool ADC_HasAccumulatorOverflowed (void)
Determines whether the accumulator has overflowed for the current context.
-
adc_result_t ADC_FilterValueGet (void)
Retrieves the value of the ADC Filter (ADFLTR) register for the current context.
-
adc_result_t ADC_PreviousResultGet (void)
Retrieves the value of the ADC Previous Result (ADPREV) register for the current context.
-
void ADC_SetPointDefine (adc_threshold_t setPoint)
Sets the value of the ADC Threshold Setpoint (ADSTPT) register for the current context.
-
adc_result_t ADC_ErrorCalculationGet (void)
Retrieves the value of the ADC Setpoint Error (ADERR) register for the current context.
-
void ADC_DoubleSamplingEnable (void)
Sets the Double-Sample Enable (DSEN) bit to '1' for the current context.
-
void ADC_DoubleSamplingDisable (void)
Sets the Double-Sample Enable (DSEN) bit to '0' for the current context.
-
void ADC_ContinuousConversionEnable (void)
Sets the Continuous Operation Enable (CONT) bit to '1' for the current context.
-
void ADC_ContinuousConversionDisable (void)
Sets the Continuous Operation Enable (CONT) bit to '0' for the current context.
-
bool ADC_IsErrorGreaterThanUpperThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is greater than the upper threshold for the current context.
-
bool ADC_IsErrorLesserThanLowerThreshold (void)
Determines if the value in the ADC Setpoint Error (ADERR) register is lesser than the lower threshold for the current context.
-
adc_conversion_stage_t ADC_ConversionStageStatusGet (void)
Retrieves the conversion stage status for the current context.
-
void ADC_ErrorCalculationModeSet (adc_calculation_mode_t errorCalculationMode)
Sets the ADC Error Calculation Mode Select (CALC) bits for the current context.
-
void ADC_CalculationRightShiftSet (uint8_t rightShiftValue)
Sets the ADC Accumulated Calculation Right Shift Select (CRS) bits for the current context.
-
void ADC_ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag bit to '0' for the current context.
-
bool ADC_IsThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt (ADCHxIF) flag for the current context.
-
void ADC_AutoTriggerSourceSet (adc_trigger_source_t triggerSource)
Sets the auto conversion trigger source for all ADC contexts.
-
uint8_t ADC_ResolutionGet (void)
Returns the resolution of the ADC module.
-
void ADC_ChargePumpEnable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '1'.
-
void ADC_ChargePumpDisable (void)
Sets the ADC Charge Pump On Control (CPON) bit to '0'.
-
bool ADC_IsChargePumpReady (void)
Checks the Charge Pump Ready status.
-
bool ADC_IsBusy (void)
Returns the busy status of the ADC module.
-
void ADC_BusyStatusSet (bool status)
Sets the busy status of the ADC module.
-
void ADC_ConversionDoneInterruptFlagClear (void)
Clears the ADC Conversion Done Interrupt Flag (ADIF) bit to '0'.
-
void ADC_Context1ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH1IF) bit to '0' for ADC Context 1.
-
void ADC_Context2ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH2IF) bit to '0' for ADC Context 2.
-
void ADC_Context3ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH3IF) bit to '0' for ADC Context 3.
-
void ADC_Context4ThresholdInterruptFlagClear (void)
Clears the ADC Threshold Interrupt Flag (ADCH4IF) bit to '0' for ADC Context 4.
-
bool ADC_IsConversionDoneInterruptFlagSet (void)
Checks the ADC Conversion Done Interrupt Flag (ADIF) status.
-
bool ADC_IsContext1ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH1IF) status for ADC Context 1.
-
bool ADC_IsContext2ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH2IF) status for ADC Context 2.
-
bool ADC_IsContext3ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH3IF) status for ADC Context 3.
-
bool ADC_IsContext4ThresholdInterruptFlagSet (void)
Checks the ADC Threshold Interrupt Flag (ADCH4IF) status for ADC Context 4.
-
void ADC_ConversionDoneCallbackRegister (void(*callback)(void))
Sets the callback function for the ADC Conversion Done Interrupt (ADI).
-
void ADC_ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the threshold interrupt of the current context.
-
void ADC_Context1ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 1 (ADCH1) threshold interrupt.
-
void ADC_Context2ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 2 (ADCH2) interrupt.
-
void ADC_Context3ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 3 (ADCH3) interrupt.
-
void ADC_Context4ThresholdCallbackRegister (void(*callback)(void))
Sets the callback for the ADC Context 4 (ADCH4) interrupt.
-
void ADC_ChannelScanEnable (adc_context_t context)
Includes the selected channel context in the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelScanDisable (adc_context_t context)
Excludes the selected channel context from the scan sequence. Select the correct context using ADC_ContextSelect before calling this API.
-
void ADC_ChannelSequencerEnable (void)
Enables the ADC channel sequencer.
-
void ADC_ChannelSequencerDisable (void)
Disables the ADC channel sequencer.
-
void ADC_Tasks (void)
Implements the Tasks routine for the polling implementations.
Variables
static bool adc_busy_status
static void(* ADC_ConversionDoneCallback )(void)
static void(* ADC_Context1ThresholdCallback )(void)
static void(* ADC_Context2ThresholdCallback )(void)
static void(* ADC_Context3ThresholdCallback )(void)
static void(* ADC_Context4ThresholdCallback )(void)
Detailed Description
This file contains the API implementations for the ADC driver.
ADC Generated Driver File
Variable Documentation
adc_busy_status
bool adc_busy_status[static]
ADC_Context1ThresholdCallback
void(* ADC_Context1ThresholdCallback) (void)[static]
ADC_Context2ThresholdCallback
void(* ADC_Context2ThresholdCallback) (void)[static]
ADC_Context3ThresholdCallback
void(* ADC_Context3ThresholdCallback) (void)[static]
ADC_Context4ThresholdCallback
void(* ADC_Context4ThresholdCallback) (void)[static]
ADC_ConversionDoneCallback
void(* ADC_ConversionDoneCallback) (void)[static]
3.1.3.1.7 Melody ADCCC Use Cases
Melody ADCCC Use Case 1 - Configure ADC Basic Mode & Data Streamer
For new users it is recommended to start with a single-ended ADC read to make the learning curve easier. The output will be displayed using Data Streamer.
-
Add the following drivers/libraries to the project:
-
Data Streamer
-
ADC
-
-
DataStreamer Configuration:
-
UART Dependency: UART2
-
Variable type: uint16_t
-
Variable name: adc_result
-
-
ADC Easy View Configuration:
-
Single-ended mode
-
Right-justified
-
VDD 3.3V
-
Clock Selection ADCRC
-
-
ADC Context 1 Configuration:
-
Positive Channel: ANA2
-
Positive Reference: VDD
-
-
Configure Pin Grid View:
-
PORTA Pin 2 as ANPx input
-
Set UART Tx Pin as Output (RB4 on Q71 Curiosity Nano)
-
-
Generate the code
-
Add the code snippet(s) to the application code
-
Program the board
-
Open Data Visualizer, Click New Variable Streamer, Import, mcc_generated_files -> data_streamer -> data_streamer.ds. Click Next, then Finish.
#include "mcc_generated_files/system/system.h"
volatile bool SEND_FRAME = false;
void DS_Frame_Update(void){
DataStreamer.adc_result = ADC_GetSingleConversion(channel_ANA2);
SEND_FRAME = true;
}
int main(void) { SYSTEM_Initialize(); DataStreamer.adc_result = 0; while(1) { DS_Frame_Update(); // write the result of an ADC read to the Data Streamer struct if(SEND_FRAME) { // if the Data Streamer frame has been updated WriteFrame(); // Write the new frame SEND_FRAME = false; // Set the boolean back to false for next time LED_Toggle(); // Toggle the LED as a visual indicator } } }
Melody ADCCC Use Case 2 - ADCCC in Burst Average mode with DataStreamer of ADC Result
The ADC is configured to take 16 samples and then average the result. This is useful for mitigating random noise. The averaged ADC result is sent to DataStreamer, for display in Data Visualizer. After each ADC conversion is completed and sent to DataStreamer the onboard LED is toggled.
-
Add ADC
-
Add DataStreamer
-
Single-ended mode
-
Right-justified
-
VDD 3.3V
-
External Positive Reference Voltage: 3.3V
-
Clock Selection ADCRC
-
Positive Channel: ANA2
-
Positive Reference: VDD
-
Operating Mode Selection: Burst_Average_mode
-
Error Calculation Mode: First derivative of filtered value
-
Upper Threshold: 3.3V
-
Lower Threshold: 0V
-
Threshold Setpoint: 0V
-
Repeat Threshold: 64
-
Accumulator Right Shift: 6
-
Acquisition Count: 1 (minimum, dependent on analog circuit output impedance)
-
Configuration Settings:
-
Variable type: uint16_t
-
Variable name: adc_result
-
-
Dependency Selector:
-
UART Dependency: UART2.
-
-
Clock Configuration: Default (1 MHz)
-
Pins: (For all pins check board schematics)
-
Pin Grid View: Select an ANx (ANA2).
-
Pin Grid View: Select pin for UART Transmit - Tx (RB4).
-
Pin Grid View: Select LED pin as output.
-
Pins: Rename Custom Name to "LED".
-
-
PORTA Pin 2 as ANPx input
-
Set UART Tx Pin as Output (RB4 on Q71 Curiosity Nano)
-
Generate the code
-
Add the code snippet(s) to the application code
-
Program the board
-
Open Data Visualizer, Click New Variable Streamer, Import, mcc_generated_files -> data_streamer -> data_streamer.ds. Click Next, then Finish.
#include "mcc_generated_files/system/system.h"
volatile bool SEND_FRAME = false;
void DS_Frame_Update(void){
ADC_SetChannel(channel_ANA2);
ADC_StartConversion();
while(!(ADC_IsConversionDone()));
DataStreamer.adc_result = ADC_GetFilterValue();
SEND_FRAME = true;
}
int main(void) { SYSTEM_Initialize(); DataStreamer.adc_result = 0; while(1) { DS_Frame_Update(); if(SEND_FRAME) { WriteFrame(); SEND_FRAME = false; LED_Toggle(); } } }
Melody ADCCC Use Case 3 - Leveraging ADCCC Functionality to Mitigate Periodic Noise and Displaying using DataStreamer.
This Use Case uses the Signal and Noise Generator board, along with the Curiosity Nano Base and Q71 Curiosity Nano development board. The ADC is configured to use the System Clock prescaled as its base clock. The user can then tune away from periodic noise by modifying the number of samples accumulated and thus the acquisition count/time. The filtered ADC result is sent to DataStreamer, for display in Data Visualizer. After each ADC conversion is completed and sent to DataStreamer the onboard LED is toggled.
Set the Signal and Noise Generator to output a DC voltage, then add Periodic Noise with frequency 100kHz and amplitude 0.1Vpp.
-
Add ADC
-
Add DataStreamer
-
Single-ended mode
-
Right-justified
-
VDD 3.3V
-
External Positive Reference Voltage: 3.3V
-
Clock Selection: FOSC
-
Clock Divider: FOSC/4 ADC Context 1 Configuration:
-
Positive Channel: ANA2
-
Positive Reference: VDD
-
Operating Mode Selection: Burst_Average_mode
-
Error Calculation Mode: Filtered Value vs Setpoint
-
Upper Threshold: 32767
-
Lower Threshold: -32768
-
Threshold Setpoint: 0
-
Repeat Threshold: 64
-
Accumulator Right Shift: 6
-
Acquisition Count: 8191 (Note Acquistion Time of 2.048ms)
-
Previous Sample Input: FLTR
-
Configuration Settings:
-
Variable type: uint16_t
-
Variable name: adc_result
-
-
Dependency Selector:
-
UART Dependency: UART2.
-
-
Clock Configuration: 4 MHz
-
Clock Source: HFINTOSC
-
HF Internal Clock: 4 MHz
-
Clock Divider: 1
-
-
Configure Pin Grid View:
-
PORTA Pin 2 as ANPx input
-
Set UART Tx Pin as Output (RB4 on Q71 Curiosity Nano)
-
Select LED pin as output (RC7 on Q71 Curiosity Nano)
-
Rename Custom Name to "LED"
-
-
Generate the code
-
Add the code snippet(s) to the application code
-
Program the board
-
Open Data Visualizer, Click New Variable Streamer, Import, mcc_generated_files -> data_streamer -> data_streamer.ds. Click Next, then Finish.
#include "mcc_generated_files/system/system.h"
volatile bool SEND_FRAME = false;
uint16_t adcResult;
void DS_Frame_Update(void){
ADC_StartConversion();
while(!(ADC_IsConversionDone()));
DataStreamer.adc_result = ADC_GetFilterValue();
LED_Toggle();
SEND_FRAME = true;
}
int main(void) { SYSTEM_Initialize(); ADC_SetChannel(channel_ANA2); DataStreamer.adc_result = 0; // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global Interrupts // Use the following macros to: // Enable the Global Interrupts //INTERRUPT_GlobalInterruptEnable(); // Disable the Global Interrupts //INTERRUPT_GlobalInterruptDisable(); while(1) { // Start ADC conversion and wait for result ADC_StartConversion(); while(!(ADC_IsConversionDone())); // Return Filtered value adcResult = ADC_GetFilterValue(); DS_Frame_Update(); // write the result of an ADC read to the Data Streamer struct if(SEND_FRAME) { // if the Data Streamer frame has been updated WriteFrame(); // Write the new frame SEND_FRAME = false; // Set the boolean back to false for next time LED_Toggle(); // Toggle the LED as a visual indicator } } }Build the project and program the device. Open Data Visualizer and view the noise on the ADC signal. The Data Axis can be adjusted to zoom in on the noise.
Now change the following MCC Melody settings:
-
Acquisition Count: 130 (Note Acquistion Time of 32.5us) After changing the ADC configuration, click 'Generate' to generate the code. Build the project and program the device. Open Data Visualizer and observe the noise is mitigated on the ADC signal. The Data Axis can be adjusted to zoom in on the noise.
Melody ADCCC Use Case 4 - Window Detection
Create an ADC window detector with upper and lower thresholds. Lower bound 1.0V and upper bound 2.0V. Take a single ADC read and compare to window thresholds. If outside of user defined window (above 2.0V or below 1.0V), turn on LED.
-
Add ADC3
-
Add Data Streamer
-
Hardware Settings:
-
Set Input Configuration: Single Ended Mode
-
Set Result Format: Right Justified
-
VDD (V): 3.3
-
-
Clock Selection: ADCRC
-
Context 1 Channel Selection
-
Positive Channel Selection: ANA2 (if using Signal and Noise Generator)
-
-
Computation and Threshold Comparison:
-
Operating Mode Selection: Basic Mode
-
Error Calculation Mode: Actual Result vs Setpoint
-
Threshold Interrupt Mode: ADERR < ADLTH or ADERR > ADUTH
-
Upper Threshold (V): 2
-
Lower Threshold (V): 1
-
Threshold Setpoint (V): 0
-
-
Advanced Hardware Settings:
-
Acquisition Count: 1 (if using Signal and Noise Generator or other device with buffered output)
-
Previous Sample Input: RES
-
-
Interrupt Settings:
-
ADCH1 Interrupt Enable
-
-
Software Settings:
-
UART Dependency Selection: Select the UART that is connected to Serial/CDC port. On Q71 Curiosity Nano, this is UART2.
-
-
Data Streamer Table:
-
Add variable: uint16_t adc_result
-
Add variable: uint8_t LED_state
-
-
Clock Configuration: Default (1 MHz)
-
Configure Pin Grid View:
-
PORTA Pin 2 as ANPx input
-
Set UART Tx Pin as Output (RB4 on Q71 Curiosity Nano)
-
Select LED pin as output (RC7 on Q71 Curiosity Nano)
-
Rename Custom Name to "LED"
-
-
Generate the code
-
Add the code snippet(s) to the application code
-
Program the board
-
Open Data Visualizer, Click New Variable Streamer, Import, mcc_generated_files -> data_streamer -> data_streamer.ds. Click Next, then Finish.
#include "mcc_generated_files/system/system.h"
volatile bool SEND_FRAME = false;
uint16_t adc_result;
volatile uint8_t outside_threshold = 0;
void DS_Frame_Update(void){
ADC_StartConversion();
while(!(ADC_IsConversionDone()));
DataStreamer.adc_result = ADC_GetFilterValue();
LED_Toggle();
SEND_FRAME = true;
}
void ADC_Interrupt_Threshold_ISR(void) { // Clear the ADC interrupt flag PIR1bits.ADCH1IF = 0; // Set software flag to use in while(1) loop outside_threshold = 1; }
int main(void) { SYSTEM_Initialize(); // Point interrupt Handler to our custom ISR ADC_SetContext1ThresholdInterruptHandler(&ADC_Interrupt_Threshold_ISR); // If using Signal and Noise Generator board, use pin RA2 ADC_SetChannel(channel_ANA2); // Initialize Data Streamer ADC variable DataStreamer.adc_result = 0; // Enable the Global Interrupts INTERRUPT_GlobalInterruptEnable(); while(1) { // Check if outside user defined threshold // If so turn on LED (active LOW) { if (outside_threshold) { LED_SetLow(); // turn on LED outside_threshold = 0; // reset so it can be set again by ISR } else LED_SetHigh(); // otherwise turn off LED DS_Frame_Update(); if(SEND_FRAME) { // if the Data Streamer frame has been updated WriteFrame(); // Write the new frame SEND_FRAME = false; // Set the boolean back to false for next time } } }
Melody ADCCC Use Case 5 - Using FVR as ADC voltage reference to scale ADC reads
This is useful when working with a small single-ended analog signal that does not use full range from GND to VDD. This Use Case narrows the ADC window of interest using FVR (Fixed Voltage Reference) predefined voltage references: 1.024V, 2.048V, 4.096V
-
Add ADC3
-
Add FVR
-
Add Data Streamer
-
Software Settings:
-
UART Dependency Selection: Select the UART that is connected to Serial/CDC port. On Q71 Curiosity Nano, this is UART2.
-
-
Data Streamer Table:
-
Add variable: uint16_t adc_result
-
-
Hardware Settings:
-
Enable FVR
-
FVR Buffer Gain to ADC: 2x (note the voltage 2.048V is listed when this option is selected)
-
FVR Buffer Gain to other Peripherals: OFF
-
-
Hardware Settings:
-
Set Input Configuration: Single Ended Mode
-
Set Result Format: Right Justified
-
VDD (V): 3.3
-
-
Clock Selection: ADCRC
-
Context 1 Channel Selection
-
Positive Channel Selection: ANA2 (if using Signal and Noise Generator)
-
Positive Voltage Reference: FVR
-
-
Computation and Threshold Comparison:
-
Operating Mode Selection: Basic Mode
-
-
Advanced Hardware Settings:
-
Acquisition Count: 1 (if using Signal and Noise Generator or other device with buffered output)
-
Previous Sample Input: RES
-
-
Configure Pin Grid View:
-
PORTA Pin 2 as ANPx input
-
Set UART Tx Pin as Output (RB4 on Q71 Curiosity Nano)
-
-
Generate the code
-
Add the code snippet(s) to the application code
-
Program the board
-
Open Data Visualizer, Click New Variable Streamer, Import, mcc_generated_files -> data_streamer -> data_streamer.ds. Click Next, then Finish.
-
If using Signal and Noise Generator board, select either Sine Wave or Square Wave and adjust signal Amplitude and Offset to fit within ADCCC reference voltage.
#include "mcc_generated_files/system/system.h"
volatile bool SEND_FRAME = false;
uint16_t adc_result;
void DS_Frame_Update(void){
ADC_StartConversion();
while(!(ADC_IsConversionDone()));
DataStreamer.adc_result = ADC_GetFilterValue();
LED_Toggle();
SEND_FRAME = true;
}
int main(void) { SYSTEM_Initialize(); // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global Interrupts // Use the following macros to: // Enable the Global Interrupts //INTERRUPT_GlobalInterruptEnable(); // Disable the Global Interrupts //INTERRUPT_GlobalInterruptDisable(); while(1) { DS_Frame_Update(); if(SEND_FRAME) { // if the Data Streamer frame has been updated WriteFrame(); // Write the new frame SEND_FRAME = false; // Set the boolean back to false for next time } } }
Melody ADCCC Use Case 6 - Using DAC as ADC voltage reference
This is useful when working with a small analog signal that does not range from GND to VDD. This Use Case narrows the range of the ADC window using the DAC as a reference, which is useful when one of the FVR internal references (see ADCCC Use Case 5) is not close enough to the ADC range of interest. The user can set a specific reference voltage in order to maximize the ADC resolution over the ADC input range of interest.
-
Add ADC3
-
Add DAC
-
Add Data Streamer
-
Software Settings:
-
UART Dependency Selection: Select the UART that is connected to Serial/CDC port. On Q71 Curiosity Nano, this is UART2.
-
-
Data Streamer Table:
-
Add variable: uint16_t adc_result
-
-
Software Settings:
-
VDD: Enter microcontroller VDD. This example uses 3.3V
-
Required Ref: Enter reference voltage (between 1.8V and VDD). This example uses 1.8V
-
-
Hardware Settings:
-
DAC Enable: Turn ON
-
DAC Positive Reference Selection: VDD
-
DAC Negative Reference Selection: VSS
-
DAC Output Enable Selection: DACOUT2 Enabled and DACOUT1 Disabled (DACOUT1 on pin RA2, DACOUT2 on pin RB7)
-
-
Hardware Settings:
-
Set Input Configuration: Single Ended Mode
-
Set Result Format: Right Justified
-
VDD (V): Enter microcontroller VDD. This example uses 3.3V
-
-
Clock Selection: ADCRC
-
Context 1 Channel Selection
-
Positive Channel Selection: ANA2 (if using Signal and Noise Generator)
-
Positive Voltage Reference: External (The VREF field fill be automatically populated. If it is incorrect, check correct VDD value has been entered for both DAC and ADC.)
-
-
Computation and Threshold Comparison:
-
Operating Mode Selection: Basic Mode
-
-
Advanced Hardware Settings:
-
Acquisition Count: 1 (if using Signal and Noise Generator or other device with buffered output)
-
Previous Sample Input: RES
-
-
Configure Pin Grid View:
-
PORTA Pin 2 as ANPx input
-
Set UART Tx Pin as Output (RB4 on Q71 Curiosity Nano)
-
IMPORTANT NOTE: Place a jumper wire between DAC output (RB7) and ADC VREF+ (RA3).
-
Generate the code
-
Add the code snippet(s) to the application code
-
Program the board
-
Open Data Visualizer, Click New Variable Streamer, Import, mcc_generated_files -> data_streamer -> data_streamer.ds. Click Next, then Finish.
-
If using Signal and Noise Generator board, select either Sine Wave or Square Wave and adjust signal Amplitude and Offset to fit within ADCCC reference voltage.
#include "mcc_generated_files/system/system.h"
volatile bool SEND_FRAME = false;
void DS_Frame_Update(void){
ADC_StartConversion();
while(!(ADC_IsConversionDone()));
DataStreamer.adc_result = ADC_GetConversionResult();
SEND_FRAME = true;
}
int main(void) { SYSTEM_Initialize(); while(1) { DS_Frame_Update(); // write the result of an ADC read to the Data Streamer struct if(SEND_FRAME) { // if the Data Streamer frame has been updated WriteFrame(); // Write the new frame SEND_FRAME = false; // Set the boolean back to false for next time } } }