4.1.2.2 10-bit ADCC with Ch. Group Sel.
10-bit ADC with Computation and Channel Group Selection
4.1.2.2.1 Introduction
The Analog-to-Digital Converter with Computation (ADCC) peripheral converts both single-ended and differential analog input signals to a 10-bit binary representation of that signal. This peripheral takes in analog signals and combines them into a Sample-and-Hold (S/H) circuit. It is then fed to a converter to turn this measurement into a 10-digit binary number and is stored in the ADC result registers. This ADCC also supports Channel Grouping which allows multiple, simultaneous input connections to the ADC.
4.1.2.2.2 Supported Device Families
PIC16F180xx | PIC18F-Q20 |
4.1.2.2.3 Required header files:
#include "mcc_generated_files/adcc/adcc.h"
4.1.2.2.4 Module Documentation
ADCC
This file contains the API prototypes and data types for the ADCC driver.
Module description
This file contains the API prototypes and data types for the ADCC driver.
Typedefs
typedef uint16_t adc_result_t
Used for the result of the Analog-to-Digital (A/D) conversion.
Definitions
#define ADCC_Initialize ADCC_Initialize
Defines the Custom Name for the ADCC_Initialize API.
#define ADCC_DischargeSampleCapacitor ADCC_DischargeSampleCapacitor
Defines the Custom Name for the ADCC_DischargeSampleCapacitor API.
#define ADCC_StartConversion ADCC_StartConversion
Defines the Custom Name for the ADCC_StartConversion API.
#define ADCC_StopConversion ADCC_StopConversion
Defines the Custom Name for the ADCC_StopConversion API.
#define ADCC_IsConversionDone ADCC_IsConversionDone
Defines the Custom Name for the ADCC_IsConversionDone API.
#define ADCC_GetConversionResult ADCC_GetConversionResult
Defines the Custom Name for the ADCC_GetConversionResult API.
#define ADCC_GetSingleConversion ADCC_GetSingleConversion
Defines the Custom Name for the ADCC_GetSingleConversion API.
#define ADCC_GetConversionStageStatus ADCC_GetConversionStageStatus
Defines the Custom Name for the ADCC_GetConversionStageStatus API.
#define ADCC_EnableContinuousConversion ADCC_EnableContinuousConversion
Defines the Custom Name for the ADCC_EnableContinuousConversion API.
#define ADCC_DisableContinuousConversion ADCC_DisableContinuousConversion
Defines the Custom Name for the ADCC_DisableContinuousConversion API.
#define ADCC_SetStopOnInterrupt ADCC_SetStopOnInterrupt
Defines the Custom Name for the ADCC_SetStopOnInterrupt API.
#define ADCC_EnableDoubleSampling ADCC_EnableDoubleSampling
Defines the Custom Name for the ADCC_EnableDoubleSampling API.
#define ADCC_LoadAcquisitionRegister ADCC_LoadAcquisitionRegister
Defines the Custom Name for the ADCC_LoadAcquisitionRegister API.
#define ADCC_SetPrechargeTime ADCC_SetPrechargeTime
Defines the Custom Name for the ADCC_SetPrechargeTime API.
#define ADCC_DefineSetPoint ADCC_DefineSetPoint
Defines the Custom Name for the ADCC_DefineSetPoint API.
#define ADCC_SetUpperThreshold ADCC_SetUpperThreshold
Defines the Custom Name for the ADCC_SetUpperThreshold API.
#define ADCC_SetLowerThreshold ADCC_SetLowerThreshold
Defines the Custom Name for the ADCC_SetLowerThreshold API.
#define ADCC_HasErrorCrossedUpperThreshold ADCC_HasErrorCrossedUpperThreshold
Defines the Custom Name for the ADCC_HasErrorCrossedUpperThreshold API.
#define ADCC_HasErrorCrossedLowerThreshold ADCC_HasErrorCrossedLowerThreshold
Defines the Custom Name for the ADCC_HasErrorCrossedLowerThreshold API.
#define ADCC_SetRepeatCount ADCC_SetRepeatCount
Defines the Custom Name for the ADCC_SetRepeatCount API.
#define ADCC_GetCurrentCountofConversions ADCC_GetCurrentCountofConversions
Defines the Custom Name for the ADCC_GetCurrentCountofConversions API.
#define ADCC_GetAccumulatorValue ADCC_GetAccumulatorValue
Defines the Custom Name for the ADCC_GetAccumulatorValue API.
#define ADCC_ClearAccumulator ADCC_ClearAccumulator
Defines the Custom Name for the ADCC_ClearAccumulator API.
#define ADCC_HasAccumulatorOverflowed ADCC_HasAccumulatorOverflowed
Defines the Custom Name for the ADCC_HasAccumulatorOverflowed API.
#define ADCC_GetErrorCalculation ADCC_GetErrorCalculation
Defines the Custom Name for the ADCC_GetErrorCalculation API.
#define ADCC_GetPreviousResult ADCC_GetPreviousResult
Defines the Custom Name for the ADCC_GetPreviousResult API.
#define ADCC_GetFilterValue ADCC_GetFilterValue
Defines the Custom Name for the ADCC_GetFilterValue API.
#define ADCC_SetADIInterruptHandler ADCC_SetADIInterruptHandler
Defines the Custom Name for the ADCC_SetADIInterruptHandler API.
#define ADCC_SetADTIInterruptHandler ADCC_SetADTIInterruptHandler
Defines the Custom Name for the ADCC_SetADTIInterruptHandler API.
Enumerations
enum adcc_channel_t { channel_ADCG1 = 0x31, channel_FVR_Buffer1 = 0x3b, channel_Temp = 0x3c, channel_VDDIO3_by_10 = 0x3d, channel_VDDIO2_by_10 = 0x3e, channel_VSS = 0x3f, channel_ANA0 = 0x0 }
Contains the available ADC channels.
Functions
void ADCC_Initialize (void)
Initializes the ADC module. This routine is called before any other ADC routine.
void ADCC_StartConversion (adcc_channel_t channel)
Starts A/D conversion on the selected channel.
bool ADCC_IsConversionDone (void)
Checks if ongoing A/D conversion is complete.
adc_result_t ADCC_GetConversionResult (void)
Retrieves the result of the latest A/D conversion.
adc_result_t ADCC_GetSingleConversion (adcc_channel_t channel)
Retrieves the result of a single A/D conversion on any given channel.
void ADCC_StopConversion (void)
Stops the ongoing A/D conversion.
void ADCC_SetStopOnInterrupt (void)
Enables Stop On Interrupt bit.
void ADCC_DischargeSampleCapacitor (void)
Discharges the input sample capacitor by setting the channel to AVss.
void ADCC_LoadAcquisitionRegister (uint16_t acquisitionValue)
Loads ADC Acquisition Time Control register with the specified value.
void ADCC_SetPrechargeTime (uint16_t prechargeTime)
Loads ADC Precharge Time Control register with the specified value.
void ADCC_SetRepeatCount (uint8_t repeatCount)
Loads the ADC Repeat Count register with specified value.
uint8_t ADCC_GetCurrentCountofConversions (void)
Retrieves the current value of ADC Repeat Count register.
void ADCC_ClearAccumulator (void)
Clears the accumulator.
uint16_t ADCC_GetAccumulatorValue (void)
Retrieves the value of ADC accumulator.
bool ADCC_HasAccumulatorOverflowed (void)
Determines whether ADC accumulator has overflowed.
uint16_t ADCC_GetFilterValue (void)
Retrieves the value of the ADC Filter(ADFLTR) register.
uint16_t ADCC_GetPreviousResult (void)
Retrieves the value of the ADC Previous(ADPREV) register.
void ADCC_DefineSetPoint (uint16_t setPoint)
Sets the value of the ADC Threshold Setpoint(ADSTPT) register.
void ADCC_SetUpperThreshold (uint16_t upperThreshold)
Sets the value of ADC Upper Threshold(ADUTH) register.
void ADCC_SetLowerThreshold (uint16_t lowerThreshold)
Sets the value of ADC Lower Threshold(ADLTH) register.
uint16_t ADCC_GetErrorCalculation (void)
Retrieves the value of ADC Set-point Error register.
void ADCC_EnableDoubleSampling (void)
Enables double-sampling bit.
void ADCC_EnableContinuousConversion (void)
Enables continuous conversion.
void ADCC_DisableContinuousConversion (void)
Disables continuous conversion.
bool ADCC_HasErrorCrossedUpperThreshold (void)
Determines if ADC error has crossed the upper threshold.
bool ADCC_HasErrorCrossedLowerThreshold (void)
Determines if ADC error is less than the lower threshold.
uint8_t ADCC_GetConversionStageStatus (void)
Retrieves the multi-stage status.
void ADCC_SetADIInterruptHandler (void(*InterruptHandler)(void))
Sets the callback for the ADC Interrupt(ADI).
void ADCC_ISR (void)
Implements the ADC Interrupt(ADI) service routine for the interrupt-driven implementations.
void ADCC_SetADTIInterruptHandler (void(*InterruptHandler)(void))
Sets the callback for the ADC Threshold Interrupt(ADTI).
void ADCC_ThresholdISR (void)
Implements the ADC Threshold Interrupt(ADTI) service routine for the interrupt-driven implementations.
Definition Documentation
ADCC_ClearAccumulator
#define ADCC_ClearAccumulator ADCC_ClearAccumulator
Defines the Custom Name for the ADCC_ClearAccumulator API.
ADCC_DefineSetPoint
#define ADCC_DefineSetPoint ADCC_DefineSetPoint
Defines the Custom Name for the ADCC_DefineSetPoint API.
ADCC_DisableContinuousConversion
#define ADCC_DisableContinuousConversion ADCC_DisableContinuousConversion
Defines the Custom Name for the ADCC_DisableContinuousConversion API.
ADCC_DischargeSampleCapacitor
#define ADCC_DischargeSampleCapacitor ADCC_DischargeSampleCapacitor
Defines the Custom Name for the ADCC_DischargeSampleCapacitor API.
ADCC_EnableContinuousConversion
#define ADCC_EnableContinuousConversion ADCC_EnableContinuousConversion
Defines the Custom Name for the ADCC_EnableContinuousConversion API.
ADCC_EnableDoubleSampling
#define ADCC_EnableDoubleSampling ADCC_EnableDoubleSampling
Defines the Custom Name for the ADCC_EnableDoubleSampling API.
ADCC_GetAccumulatorValue
#define ADCC_GetAccumulatorValue ADCC_GetAccumulatorValue
Defines the Custom Name for the ADCC_GetAccumulatorValue API.
ADCC_GetConversionResult
#define ADCC_GetConversionResult ADCC_GetConversionResult
Defines the Custom Name for the ADCC_GetConversionResult API.
ADCC_GetConversionStageStatus
#define ADCC_GetConversionStageStatus ADCC_GetConversionStageStatus
Defines the Custom Name for the ADCC_GetConversionStageStatus API.
ADCC_GetCurrentCountofConversions
#define ADCC_GetCurrentCountofConversions ADCC_GetCurrentCountofConversions
Defines the Custom Name for the ADCC_GetCurrentCountofConversions API.
ADCC_GetErrorCalculation
#define ADCC_GetErrorCalculation ADCC_GetErrorCalculation
Defines the Custom Name for the ADCC_GetErrorCalculation API.
ADCC_GetFilterValue
#define ADCC_GetFilterValue ADCC_GetFilterValue
Defines the Custom Name for the ADCC_GetFilterValue API.
ADCC_GetPreviousResult
#define ADCC_GetPreviousResult ADCC_GetPreviousResult
Defines the Custom Name for the ADCC_GetPreviousResult API.
ADCC_GetSingleConversion
#define ADCC_GetSingleConversion ADCC_GetSingleConversion
Defines the Custom Name for the ADCC_GetSingleConversion API.
ADCC_HasAccumulatorOverflowed
#define ADCC_HasAccumulatorOverflowed ADCC_HasAccumulatorOverflowed
Defines the Custom Name for the ADCC_HasAccumulatorOverflowed API.
ADCC_HasErrorCrossedLowerThreshold
#define ADCC_HasErrorCrossedLowerThreshold ADCC_HasErrorCrossedLowerThreshold
Defines the Custom Name for the ADCC_HasErrorCrossedLowerThreshold API.
ADCC_HasErrorCrossedUpperThreshold
#define ADCC_HasErrorCrossedUpperThreshold ADCC_HasErrorCrossedUpperThreshold
Defines the Custom Name for the ADCC_HasErrorCrossedUpperThreshold API.
ADCC_Initialize
#define ADCC_Initialize ADCC_Initialize
Defines the Custom Name for the ADCC_Initialize API.
Section: Included Files
ADCC_IsConversionDone
#define ADCC_IsConversionDone ADCC_IsConversionDone
Defines the Custom Name for the ADCC_IsConversionDone API.
ADCC_LoadAcquisitionRegister
#define ADCC_LoadAcquisitionRegister ADCC_LoadAcquisitionRegister
Defines the Custom Name for the ADCC_LoadAcquisitionRegister API.
ADCC_SetADIInterruptHandler
#define ADCC_SetADIInterruptHandler ADCC_SetADIInterruptHandler
Defines the Custom Name for the ADCC_SetADIInterruptHandler API.
ADCC_SetADTIInterruptHandler
#define ADCC_SetADTIInterruptHandler ADCC_SetADTIInterruptHandler
Defines the Custom Name for the ADCC_SetADTIInterruptHandler API.
ADCC_SetLowerThreshold
#define ADCC_SetLowerThreshold ADCC_SetLowerThreshold
Defines the Custom Name for the ADCC_SetLowerThreshold API.
ADCC_SetPrechargeTime
#define ADCC_SetPrechargeTime ADCC_SetPrechargeTime
Defines the Custom Name for the ADCC_SetPrechargeTime API.
ADCC_SetRepeatCount
#define ADCC_SetRepeatCount ADCC_SetRepeatCount
Defines the Custom Name for the ADCC_SetRepeatCount API.
ADCC_SetStopOnInterrupt
#define ADCC_SetStopOnInterrupt ADCC_SetStopOnInterrupt
Defines the Custom Name for the ADCC_SetStopOnInterrupt API.
ADCC_SetUpperThreshold
#define ADCC_SetUpperThreshold ADCC_SetUpperThreshold
Defines the Custom Name for the ADCC_SetUpperThreshold API.
ADCC_StartConversion
#define ADCC_StartConversion ADCC_StartConversion
Defines the Custom Name for the ADCC_StartConversion API.
ADCC_StopConversion
#define ADCC_StopConversion ADCC_StopConversion
Defines the Custom Name for the ADCC_StopConversion API.
Typedef Documentation
adc_result_t
adc_result_t
Used for the result of the Analog-to-Digital (A/D) conversion.
Function Documentation
ADCC_ClearAccumulator()
void ADCC_ClearAccumulator (void )[inline]
Clears the accumulator.
None. |
None. |
ADCC_DefineSetPoint()
void ADCC_DefineSetPoint (uint16_t setPoint)
Sets the value of the ADC Threshold Setpoint(ADSTPT) register.
setPoint |
- 16-bit value for the ADC Threshold Setpoint register |
None. |
ADCC_DisableContinuousConversion()
void ADCC_DisableContinuousConversion (void )[inline]
Disables continuous conversion.
None. |
None. |
ADCC_DischargeSampleCapacitor()
void ADCC_DischargeSampleCapacitor (void )[inline]
Discharges the input sample capacitor by setting the channel to AVss.
None. |
None. |
ADCC_EnableContinuousConversion()
void ADCC_EnableContinuousConversion (void )[inline]
Enables continuous conversion.
None. |
None. |
ADCC_EnableDoubleSampling()
void ADCC_EnableDoubleSampling (void )[inline]
Enables double-sampling bit.
None. |
None. |
ADCC_GetAccumulatorValue()
uint16_t ADCC_GetAccumulatorValue (void )
Retrieves the value of ADC accumulator.
None. |
Value of ADC accumulator |
ADCC_GetConversionResult()
adc_result_t ADCC_GetConversionResult (void )
Retrieves the result of the latest A/D conversion.
ADCC_StartConversion() is called before calling this function and completion status is checked using the ADCC_IsConversionDone() routine. |
None. |
The result of A/D conversion. Refer to the adc_result_t. |
ADCC_GetConversionStageStatus()
uint8_t ADCC_GetConversionStageStatus (void )
Retrieves the multi-stage status.
ADCC_StartConversion() is called before calling this function. |
None. |
Contents of ADC STATUS register |
ADCC_GetCurrentCountofConversions()
uint8_t ADCC_GetCurrentCountofConversions (void )
Retrieves the current value of ADC Repeat Count register.
ADCC_StartConversion() is called before calling this function. |
None. |
Current value of the ADC Repeat Count register |
ADCC_GetErrorCalculation()
uint16_t ADCC_GetErrorCalculation (void )
Retrieves the value of ADC Set-point Error register.
ADCC_StartConversion() is called before calling this function. |
None. |
16-bit value obtained from the high byte ADERR(ADERRH) and low byte ADERR(ADERRL) registers. |
ADCC_GetFilterValue()
uint16_t ADCC_GetFilterValue (void )
Retrieves the value of the ADC Filter(ADFLTR) register.
None. |
16-bit value obtained from the high byte ADFLTR(ADFLTRH) and low byte ADFLTR(ADFLTRL) registers. |
ADCC_GetPreviousResult()
uint16_t ADCC_GetPreviousResult (void )
Retrieves the value of the ADC Previous(ADPREV) register.
ADCC_StartConversion() is called before calling this function. |
None. |
16-bit value obtained from the high byte ADPREV(ADPREVH) and low byte ADPREV(ADPREVL) registers. |
ADCC_GetSingleConversion()
adc_result_t ADCC_GetSingleConversion (adcc_channel_t channel)
Retrieves the result of a single A/D conversion on any given channel.
Enable ADC using the ADCC_Initialize() function. Also ADCC_DisableContinuousConversion() function is called before calling this function. |
channel |
- Analog channel number on which the A/D conversion will be applied. Refer to adcc_channel_t for available channels |
The result of a single A/D conversion. Refer to the adc_result_t. |
ADCC_HasAccumulatorOverflowed()
bool ADCC_HasAccumulatorOverflowed (void )
Determines whether ADC accumulator has overflowed.
ADCC_StartConversion() is called before calling this function. |
None. |
True |
- ADC accumulator has overflowed. |
False |
- ADC accumulator has not overflowed. |
ADCC_HasErrorCrossedLowerThreshold()
bool ADCC_HasErrorCrossedLowerThreshold (void )
Determines if ADC error is less than the lower threshold.
ADCC_StartConversion() is called before calling this function. |
None. |
True |
- ADC error has crossed the lower threshold |
False |
- ADC error has not crossed the lower threshold |
ADCC_HasErrorCrossedUpperThreshold()
bool ADCC_HasErrorCrossedUpperThreshold (void )
Determines if ADC error has crossed the upper threshold.
ADCC_StartConversion() is called before calling this function. |
None. |
True |
- ADC error has crossed the upper threshold |
False |
- ADC error has not crossed the upper threshold |
ADCC_Initialize()
void ADCC_Initialize (void )
Initializes the ADC module. This routine is called before any other ADC routine.
Section: ADCC Module APIs
None. |
None. |
Section: ADCC Module APIs
ADCC_IsConversionDone()
bool ADCC_IsConversionDone (void )
Checks if ongoing A/D conversion is complete.
ADCC_StartConversion() is called before calling this function. |
None. |
True |
- A/D conversion is complete. |
False |
- A/D conversion is ongoing. |
ADCC_ISR()
void ADCC_ISR (void )
Implements the ADC Interrupt(ADI) service routine for the interrupt-driven implementations.
None. |
None. |
ADCC_LoadAcquisitionRegister()
void ADCC_LoadAcquisitionRegister (uint16_t acquisitionValue)
Loads ADC Acquisition Time Control register with the specified value.
acquisitionValue |
- Value to be loaded in the acquisition time control register |
None. |
ADCC_SetADIInterruptHandler()
void ADCC_SetADIInterruptHandler (void(*)(void) InterruptHandler)
Sets the callback for the ADC Interrupt(ADI).
InterruptHandler |
- Callback function to be called on the interrupt event |
None. |
ADCC_SetADTIInterruptHandler()
void ADCC_SetADTIInterruptHandler (void(*)(void) InterruptHandler)
Sets the callback for the ADC Threshold Interrupt(ADTI).
InterruptHandler |
- Callback function to be called on the interrupt event |
None. |
ADCC_SetLowerThreshold()
void ADCC_SetLowerThreshold (uint16_t lowerThreshold)
Sets the value of ADC Lower Threshold(ADLTH) register.
lowerThreshold |
- 16-bit value for the ADC Lower Threshold register |
None. |
ADCC_SetPrechargeTime()
void ADCC_SetPrechargeTime (uint16_t prechargeTime)
Loads ADC Precharge Time Control register with the specified value.
prechargeTime |
- Value to be loaded in the precharge time control register |
None. |
ADCC_SetRepeatCount()
void ADCC_SetRepeatCount (uint8_t repeatCount)
Loads the ADC Repeat Count register with specified value.
repeatCount |
- Value to be loaded to repeat counter |
None. |
ADCC_SetStopOnInterrupt()
void ADCC_SetStopOnInterrupt (void )[inline]
Enables Stop On Interrupt bit.
ADCC_EnableContinuousConversion() function is called before calling this function. |
None. |
None. |
ADCC_SetUpperThreshold()
void ADCC_SetUpperThreshold (uint16_t upperThreshold)
Sets the value of ADC Upper Threshold(ADUTH) register.
upperThreshold |
- 16-bit value for the ADC Upper Threshold register |
None. |
ADCC_StartConversion()
void ADCC_StartConversion (adcc_channel_t channel)
Starts A/D conversion on the selected channel.
ADCC_Initialize() function is called before calling this function to enable ADC. |
channel |
- Analog channel number on which the A/D conversion has to be applied. Refer to adcc_channel_t for the available list of channels. |
None. |
ADCC_StopConversion()
void ADCC_StopConversion (void )[inline]
Stops the ongoing A/D conversion.
ADCC_StartConversion() function is called before calling this function. |
None. |
None. |
ADCC_ThresholdISR()
void ADCC_ThresholdISR (void )
Implements the ADC Threshold Interrupt(ADTI) service routine for the interrupt-driven implementations.
None. |
None. |
Enumeration Type Documentation
adcc_channel_t
enum adcc_channel_t
Contains the available ADC channels.
channel_ADCG1 | |
channel_FVR_Buffer1 | |
channel_Temp | |
channel_VDDIO3_by_10 | |
channel_VDDIO2_by_10 | |
channel_VSS | |
channel_ANA0 |
4.1.2.2.5 File Documentation
source/adcc.c File Reference
This file contains the API implementations for the ADCC driver.
#include <xc.h> #include "../adcc.h"
Functions
static void ADCC_DefaultADI_ISR (void)
static void ADCC_DefaultADTI_ISR (void)
void ADCC_Initialize (void)
Initializes the ADC module. This routine is called before any other ADC routine.
void ADCC_StartConversion (adcc_channel_t channel)
Starts A/D conversion on the selected channel.
bool ADCC_IsConversionDone (void)
Checks if ongoing A/D conversion is complete.
adc_result_t ADCC_GetConversionResult (void)
Retrieves the result of the latest A/D conversion.
adc_result_t ADCC_GetSingleConversion (adcc_channel_t channel)
Retrieves the result of a single A/D conversion on any given channel.
void ADCC_StopConversion (void)
Stops the ongoing A/D conversion.
void ADCC_SetStopOnInterrupt (void)
Enables Stop On Interrupt bit.
void ADCC_DischargeSampleCapacitor (void)
Discharges the input sample capacitor by setting the channel to AVss.
void ADCC_LoadAcquisitionRegister (uint16_t acquisitionValue)
Loads ADC Acquisition Time Control register with the specified value.
void ADCC_SetPrechargeTime (uint16_t prechargeTime)
Loads ADC Precharge Time Control register with the specified value.
void ADCC_SetRepeatCount (uint8_t repeatCount)
Loads the ADC Repeat Count register with specified value.
uint8_t ADCC_GetCurrentCountofConversions (void)
Retrieves the current value of ADC Repeat Count register.
void ADCC_ClearAccumulator (void)
Clears the accumulator.
uint16_t ADCC_GetAccumulatorValue (void)
Retrieves the value of ADC accumulator.
void ADCC_DefineSetPoint (uint16_t setPoint)
Sets the value of the ADC Threshold Setpoint(ADSTPT) register.
uint16_t ADCC_GetErrorCalculation (void)
Retrieves the value of ADC Set-point Error register.
void ADCC_SetUpperThreshold (uint16_t upperThreshold)
Sets the value of ADC Upper Threshold(ADUTH) register.
void ADCC_SetLowerThreshold (uint16_t lowerThreshold)
Sets the value of ADC Lower Threshold(ADLTH) register.
uint16_t ADCC_GetFilterValue (void)
Retrieves the value of the ADC Filter(ADFLTR) register.
uint16_t ADCC_GetPreviousResult (void)
Retrieves the value of the ADC Previous(ADPREV) register.
bool ADCC_HasAccumulatorOverflowed (void)
Determines whether ADC accumulator has overflowed.
void ADCC_EnableDoubleSampling (void)
Enables double-sampling bit.
void ADCC_EnableContinuousConversion (void)
Enables continuous conversion.
void ADCC_DisableContinuousConversion (void)
Disables continuous conversion.
bool ADCC_HasErrorCrossedUpperThreshold (void)
Determines if ADC error has crossed the upper threshold.
bool ADCC_HasErrorCrossedLowerThreshold (void)
Determines if ADC error is less than the lower threshold.
uint8_t ADCC_GetConversionStageStatus (void)
Retrieves the multi-stage status.
void ADCC_ISR (void)
Implements the ADC Interrupt(ADI) service routine for the interrupt-driven implementations.
void ADCC_SetADIInterruptHandler (void(*InterruptHandler)(void))
Sets the callback for the ADC Interrupt(ADI).
void ADCC_ThresholdISR (void)
Implements the ADC Threshold Interrupt(ADTI) service routine for the interrupt-driven implementations.
void ADCC_SetADTIInterruptHandler (void(*InterruptHandler)(void))
Sets the callback for the ADC Threshold Interrupt(ADTI).
Variables
static void(* ADCC_ADI_InterruptHandler )(void)
static void(* ADCC_ADTI_InterruptHandler )(void)
Detailed Description
This file contains the API implementations for the ADCC driver.
ADCC Generated Driver File
Function Documentation
ADCC_DefaultADI_ISR()
static void ADCC_DefaultADI_ISR (void )[static]
ADCC_DefaultADTI_ISR()
static void ADCC_DefaultADTI_ISR (void )[static]
Variable Documentation
ADCC_ADI_InterruptHandler
void(* ADCC_ADI_InterruptHandler) (void)[static]
Section: Included Files
ADCC_ADTI_InterruptHandler
void(* ADCC_ADTI_InterruptHandler) (void)[static]
source/adcc.h File Reference
#include <stdint.h> #include <stdbool.h>
Functions
void ADCC_Initialize (void)
Initializes the ADC module. This routine is called before any other ADC routine.
void ADCC_StartConversion (adcc_channel_t channel)
Starts A/D conversion on the selected channel.
bool ADCC_IsConversionDone (void)
Checks if ongoing A/D conversion is complete.
adc_result_t ADCC_GetConversionResult (void)
Retrieves the result of the latest A/D conversion.
adc_result_t ADCC_GetSingleConversion (adcc_channel_t channel)
Retrieves the result of a single A/D conversion on any given channel.
void ADCC_StopConversion (void)
Stops the ongoing A/D conversion.
void ADCC_SetStopOnInterrupt (void)
Enables Stop On Interrupt bit.
void ADCC_DischargeSampleCapacitor (void)
Discharges the input sample capacitor by setting the channel to AVss.
void ADCC_LoadAcquisitionRegister (uint16_t acquisitionValue)
Loads ADC Acquisition Time Control register with the specified value.
void ADCC_SetPrechargeTime (uint16_t prechargeTime)
Loads ADC Precharge Time Control register with the specified value.
void ADCC_SetRepeatCount (uint8_t repeatCount)
Loads the ADC Repeat Count register with specified value.
uint8_t ADCC_GetCurrentCountofConversions (void)
Retrieves the current value of ADC Repeat Count register.
void ADCC_ClearAccumulator (void)
Clears the accumulator.
uint16_t ADCC_GetAccumulatorValue (void)
Retrieves the value of ADC accumulator.
bool ADCC_HasAccumulatorOverflowed (void)
Determines whether ADC accumulator has overflowed.
uint16_t ADCC_GetFilterValue (void)
Retrieves the value of the ADC Filter(ADFLTR) register.
uint16_t ADCC_GetPreviousResult (void)
Retrieves the value of the ADC Previous(ADPREV) register.
void ADCC_DefineSetPoint (uint16_t setPoint)
Sets the value of the ADC Threshold Setpoint(ADSTPT) register.
void ADCC_SetUpperThreshold (uint16_t upperThreshold)
Sets the value of ADC Upper Threshold(ADUTH) register.
void ADCC_SetLowerThreshold (uint16_t lowerThreshold)
Sets the value of ADC Lower Threshold(ADLTH) register.
uint16_t ADCC_GetErrorCalculation (void)
Retrieves the value of ADC Set-point Error register.
void ADCC_EnableDoubleSampling (void)
Enables double-sampling bit.
void ADCC_EnableContinuousConversion (void)
Enables continuous conversion.
void ADCC_DisableContinuousConversion (void)
Disables continuous conversion.
bool ADCC_HasErrorCrossedUpperThreshold (void)
Determines if ADC error has crossed the upper threshold.
bool ADCC_HasErrorCrossedLowerThreshold (void)
Determines if ADC error is less than the lower threshold.
uint8_t ADCC_GetConversionStageStatus (void)
Retrieves the multi-stage status.
void ADCC_SetADIInterruptHandler (void(*InterruptHandler)(void))
Sets the callback for the ADC Interrupt(ADI).
void ADCC_ISR (void)
Implements the ADC Interrupt(ADI) service routine for the interrupt-driven implementations.
void ADCC_SetADTIInterruptHandler (void(*InterruptHandler)(void))
Sets the callback for the ADC Threshold Interrupt(ADTI).
void ADCC_ThresholdISR (void)
Implements the ADC Threshold Interrupt(ADTI) service routine for the interrupt-driven implementations.
Macros
#define ADCC_Initialize ADCC_Initialize
Defines the Custom Name for the ADCC_Initialize API.
#define ADCC_DischargeSampleCapacitor ADCC_DischargeSampleCapacitor
Defines the Custom Name for the ADCC_DischargeSampleCapacitor API.
#define ADCC_StartConversion ADCC_StartConversion
Defines the Custom Name for the ADCC_StartConversion API.
#define ADCC_StopConversion ADCC_StopConversion
Defines the Custom Name for the ADCC_StopConversion API.
#define ADCC_IsConversionDone ADCC_IsConversionDone
Defines the Custom Name for the ADCC_IsConversionDone API.
#define ADCC_GetConversionResult ADCC_GetConversionResult
Defines the Custom Name for the ADCC_GetConversionResult API.
#define ADCC_GetSingleConversion ADCC_GetSingleConversion
Defines the Custom Name for the ADCC_GetSingleConversion API.
#define ADCC_GetConversionStageStatus ADCC_GetConversionStageStatus
Defines the Custom Name for the ADCC_GetConversionStageStatus API.
#define ADCC_EnableContinuousConversion ADCC_EnableContinuousConversion
Defines the Custom Name for the ADCC_EnableContinuousConversion API.
#define ADCC_DisableContinuousConversion ADCC_DisableContinuousConversion
Defines the Custom Name for the ADCC_DisableContinuousConversion API.
#define ADCC_SetStopOnInterrupt ADCC_SetStopOnInterrupt
Defines the Custom Name for the ADCC_SetStopOnInterrupt API.
#define ADCC_EnableDoubleSampling ADCC_EnableDoubleSampling
Defines the Custom Name for the ADCC_EnableDoubleSampling API.
#define ADCC_LoadAcquisitionRegister ADCC_LoadAcquisitionRegister
Defines the Custom Name for the ADCC_LoadAcquisitionRegister API.
#define ADCC_SetPrechargeTime ADCC_SetPrechargeTime
Defines the Custom Name for the ADCC_SetPrechargeTime API.
#define ADCC_DefineSetPoint ADCC_DefineSetPoint
Defines the Custom Name for the ADCC_DefineSetPoint API.
#define ADCC_SetUpperThreshold ADCC_SetUpperThreshold
Defines the Custom Name for the ADCC_SetUpperThreshold API.
#define ADCC_SetLowerThreshold ADCC_SetLowerThreshold
Defines the Custom Name for the ADCC_SetLowerThreshold API.
#define ADCC_HasErrorCrossedUpperThreshold ADCC_HasErrorCrossedUpperThreshold
Defines the Custom Name for the ADCC_HasErrorCrossedUpperThreshold API.
#define ADCC_HasErrorCrossedLowerThreshold ADCC_HasErrorCrossedLowerThreshold
Defines the Custom Name for the ADCC_HasErrorCrossedLowerThreshold API.
#define ADCC_SetRepeatCount ADCC_SetRepeatCount
Defines the Custom Name for the ADCC_SetRepeatCount API.
#define ADCC_GetCurrentCountofConversions ADCC_GetCurrentCountofConversions
Defines the Custom Name for the ADCC_GetCurrentCountofConversions API.
#define ADCC_GetAccumulatorValue ADCC_GetAccumulatorValue
Defines the Custom Name for the ADCC_GetAccumulatorValue API.
#define ADCC_ClearAccumulator ADCC_ClearAccumulator
Defines the Custom Name for the ADCC_ClearAccumulator API.
#define ADCC_HasAccumulatorOverflowed ADCC_HasAccumulatorOverflowed
Defines the Custom Name for the ADCC_HasAccumulatorOverflowed API.
#define ADCC_GetErrorCalculation ADCC_GetErrorCalculation
Defines the Custom Name for the ADCC_GetErrorCalculation API.
#define ADCC_GetPreviousResult ADCC_GetPreviousResult
Defines the Custom Name for the ADCC_GetPreviousResult API.
#define ADCC_GetFilterValue ADCC_GetFilterValue
Defines the Custom Name for the ADCC_GetFilterValue API.
#define ADCC_SetADIInterruptHandler ADCC_SetADIInterruptHandler
Defines the Custom Name for the ADCC_SetADIInterruptHandler API.
#define ADCC_SetADTIInterruptHandler ADCC_SetADTIInterruptHandler
Defines the Custom Name for the ADCC_SetADTIInterruptHandler API.
Typedefs
typedef uint16_t adc_result_t
Used for the result of the Analog-to-Digital (A/D) conversion.
Enumerations
enum adcc_channel_t { channel_ADCG1 = 0x31, channel_FVR_Buffer1 = 0x3b, channel_Temp = 0x3c, channel_VDDIO3_by_10 = 0x3d, channel_VDDIO2_by_10 = 0x3e, channel_VSS = 0x3f, channel_ANA0 = 0x0 }
Contains the available ADC channels.
Detailed Description
ADCC Generated Driver API Header File