Solar panel
Loading...
Searching...
No Matches
adc.c File Reference
#include <xc.h>
#include "adc.h"
#include "device_config.h"

Go to the source code of this file.

Functions

void ADC_Initialize (void)
 
void ADC_SelectChannel (adc_channel_t channel)
 
void ADC_StartConversion (void)
 
bool ADC_IsConversionDone (void)
 
adc_result_t ADC_GetConversionResult (void)
 
adc_result_t ADC_GetConversion (adc_channel_t channel)
 
void ADC_TemperatureAcquisitionDelay (void)
 

Variables

void(* ADC_InterruptHandler )(void)
 

Function Documentation

◆ ADC_GetConversion()

adc_result_t ADC_GetConversion ( adc_channel_t  channel)

@Summary Returns the ADC conversion value also allows selection of a channel for conversion.

@Description This routine is used to select desired channel for conversion and to get the analog to digital converted value.

@Preconditions ADC_Initialize() function should have been called before calling this function.

@Returns Returns the converted value.

@Param Pass in required channel number. "For available channel refer to enum under adc.h file"

@Example uint16_t convertedValue;

ADC_Initialize();

conversion = ADC_GetConversion(AN1_Channel);

Definition at line 109 of file adc.c.

◆ ADC_GetConversionResult()

adc_result_t ADC_GetConversionResult ( void  )

@Summary Returns the ADC conversion value.

@Description This routine is used to get the analog to digital converted value. This routine gets converted values from the channel specified.

@Preconditions This routine returns the conversion value only after the conversion is complete. Completion status can be checked using ADC_IsConversionDone() routine.

@Returns Returns the converted value.

@Param None

@Example uint16_t convertedValue;

ADC_Initialize(); ADC_StartConversion();

while(ADC_IsConversionDone());

convertedValue = ADC_GetConversionResult();

Definition at line 103 of file adc.c.

◆ ADC_Initialize()

void ADC_Initialize ( void  )

Section: ADC Module APIs

Definition at line 61 of file adc.c.

◆ ADC_IsConversionDone()

bool ADC_IsConversionDone ( void  )

@Summary Returns true when the conversion is completed otherwise false.

@Description This routine is used to determine if conversion is completed. When conversion is complete routine returns true. It returns false otherwise.

@Preconditions ADC_Initialize() and ADC_StartConversion(void) function should have been called before calling this function.

@Returns true - If conversion is complete false - If conversion is not completed

@Param None

@Example uint16_t convertedValue;

ADC_Initialize(); ADC_StartConversion();

while(!ADC_IsConversionDone()); convertedValue = ADC_GetConversionResult();

Definition at line 97 of file adc.c.

◆ ADC_SelectChannel()

void ADC_SelectChannel ( adc_channel_t  channel)

@Summary Allows selection of a channel for conversion

@Description This routine is used to select desired channel for conversion. available

@Preconditions ADC_Initialize() function should have been called before calling this function.

@Returns None

@Param Pass in required channel number "For available channel refer to enum under adc.h file"

@Example uint16_t convertedValue;

ADC_Initialize(); ADC_SelectChannel(AN1_Channel); ADC_StartConversion(); convertedValue = ADC_GetConversionResult();

Definition at line 82 of file adc.c.

◆ ADC_StartConversion()

void ADC_StartConversion ( void  )

@Summary Starts conversion

@Description This routine is used to start conversion of desired channel.

@Preconditions ADC_Initialize() function should have been called before calling this function.

@Returns None

@Param None

@Example uint16_t convertedValue;

ADC_Initialize();
ADC_StartConversion(); convertedValue = ADC_GetConversionResult();

Definition at line 90 of file adc.c.

◆ ADC_TemperatureAcquisitionDelay()

void ADC_TemperatureAcquisitionDelay ( void  )

@Summary Acquisition Delay for temperature sensor

@Description This routine should be called when temperature sensor is used.

@Preconditions ADC_Initialize() function should have been called before calling this function.

@Returns None

@Param None

@Example uint16_t convertedValue;

ADC_Initialize();
ADC_StartConversion(); ADC_temperatureAcquisitionDelay(); convertedValue = ADC_GetConversionResult();

Definition at line 129 of file adc.c.

Variable Documentation

◆ ADC_InterruptHandler

void(* ADC_InterruptHandler) (void) ( void  )

ADC Generated Driver File

@Company Microchip Technology Inc.

@File Name adc.c

@Summary This is the generated driver implementation file for the ADC driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs

@Description This source file provides implementations for driver APIs for ADC. Generation Information : Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8 Device : PIC18F97J60 Driver Version : 2.02 The generated drivers are tested against the following: Compiler : XC8 2.36 and above MPLAB : MPLAB X 6.00 Section: Included Files

Definition at line 55 of file adc.c.