4.1.1.2 10-bit ADC with Auto Trigger

10-bit Analog-to-Digital Converter with Auto-conversion Trigger

4.1.1.2.1 Introduction

This ADC allows conversion of an analog input signal to a 10-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 10-bit binary result via successive approximation and stores the conversion result into the ADC result registers. This ADC module also features an auto-conversion trigger which allows periodic ADC measurements without software intervention.

4.1.1.2.2 Supported Device Families

  • PIC12/16F150x
  • PIC16F152x
  • PIC16F176x
  • PIC16F151x
  • PIC16F145x
  • PIC12/16F157x
  • PIC16F152xx
  • PIC16F177x
  • PIC16F171x
  • PIC16LF190x
  • PIC12/16F161x
  • PIC16F153xx
  • PIC16F183xx
  • PIC12/16F184x
  • PIC16F170x
  • PIC16F194x

4.1.1.2.3 Required Header Files:

#include "mcc_generated_files/adc/adc.h"

4.1.1.2.4 Module Documentation

ADC

This file contains the API prototypes and data types for the ADC driver.

Module description

This file contains the API prototypes and data types for the ADC driver.

Version: ADC Driver Version 2.1.3
Typedefs
  • typedef uint16_t adc_result_t

    Used for the result of the Analog-to-Digital (A/D) conversion.

Functions

Typedef Documentation

adc_result_t

adc_result_t

Used for the result of the Analog-to-Digital (A/D) conversion.

Function Documentation

ADC_GetConversion()

adc_result_t ADC_GetConversion (adc_channel_t channel)

Retrieves the result of a single A/D conversion on any given channel.

Parameters:
channel

- Analog channel number on which the A/D conversion will be applied. Refer to adc_channel_t for the available channels.

Returns:

The result of A/D conversion. Refer to the adc_result_t.

ADC_GetConversionResult()

adc_result_t ADC_GetConversionResult (void )

Retrieves the result of the latest A/D conversion.

Parameters:
None.
Returns:

The result of A/D conversion. Refer to the adc_result_t.

ADC_Initialize()

void ADC_Initialize (void )

Initializes the ADC module. This routine is called before any other ADC routine.

Section: ADC Module APIs

Parameters:
None.
Returns:

None.

Section: ADC Module APIs

ADC_IsConversionDone()

bool ADC_IsConversionDone (void )

Checks if ongoing A/D conversion is complete.

Parameters:
None.
Return values:
True

- A/D conversion is complete.

False

- A/D conversion is ongoing.

ADC_ISR()

void ADC_ISR (void )

Implements the ADC Interrupt(ADI) service routine for the interrupt-driven implementations.

Parameters:
None.
Returns:

None.

ADC_SelectChannel()

void ADC_SelectChannel (adc_channel_t channel)

Selects the channel for the A/D conversion.

Parameters:
channel

- Analog channel number on which the A/D conversion will be applied. Refer to adc_channel_t for the available channels.

Returns:

None.

ADC_SetInterruptHandler()

void ADC_SetInterruptHandler (void(*)(void) InterruptHandler)

Sets the callback for the ADC Interrupt(ADI).

Parameters:
InterruptHandler

- Callback function to be called on the interrupt event.

Returns:

None.

ADC_StartConversion()

void ADC_StartConversion (void )

Starts A/D conversion.

Parameters:
None.
Returns:

None.

ADC_TemperatureAcquisitionDelay()

void ADC_TemperatureAcquisitionDelay (void )

Adds the acquisition delay for the temperature sensor.

Precondition:

This function is called when temperature sensor is used.

Parameters:
None.
Returns:

None.

Enumeration Type Documentation

adc_channel_t

enum adc_channel_t

Contains the available ADC channels.

channel_AVSS
channel_Temp
channel_DAC1
channel_FVR

4.1.1.2.5 Class Documentation

adc_sync_double_result_t Struct Reference

#include <adc.h>

Member Data Documentation

The documentation for this struct was generated from the following file:

source/

adc.h

adcResult1

adc_result_t adcResult1

adcResult2

adc_result_t adcResult2

Used Struct Reference

Detailed Description

result for a Double ADC conversion value.

The documentation for this struct was generated from the following file:

source/

adc.h

4.1.1.2.6 File Documentation

source/adc.c File Reference

This file contains the API implementations for the ADC module.

#include <xc.h>
#include "../adc.h"
#include "../../system/clock.h"

Functions

Detailed Description

This file contains the API implementations for the ADC module.

ADC Generated Driver File

Version: ADC Driver Version 2.1.3

Function Documentation

ADC_DefaultInterruptHandler()

static void ADC_DefaultInterruptHandler (void )[static]

Macro Definition Documentation

ACQ_US_DELAY

#define ACQ_US_DELAY 5

Section: Included Files Section: Macro Declarations

Variable Documentation

ADC_InterruptHandler

void(* ADC_InterruptHandler) (void)

source/adc.h File Reference

#include <xc.h>
#include <stdint.h>
#include <stdbool.h>

Functions

Typedefs

  • typedef uint16_t adc_result_t

    Used for the result of the Analog-to-Digital (A/D) conversion.

Detailed Description

ADC Generated Driver API Header File