Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ADC - Analog to Digital Converter

Analog to Digital Converter is able to capture analog signals and transform them into digital format with 10-bit resolution.

Macros

#define ADC_MAX_VALUE   0x3FF
 Max value for ADC resolution. More...
 

Functions

bool adc_check_eoc (volatile avr32_adc_t *adc, uint16_t channel)
 Check channel conversion status. More...
 
bool adc_check_ovr (volatile avr32_adc_t *adc, uint16_t channel)
 Check channel conversion overrun error. More...
 
void adc_configure (volatile avr32_adc_t *adc)
 Configure ADC. More...
 
void adc_disable (volatile avr32_adc_t *adc, uint16_t channel)
 Disable channel. More...
 
void adc_enable (volatile avr32_adc_t *adc, uint16_t channel)
 Enable channel. More...
 
uint32_t adc_get_latest_value (volatile avr32_adc_t *adc)
 Wait for the next converted data and return its value. More...
 
bool adc_get_status (volatile avr32_adc_t *adc, uint16_t channel)
 Get channel 0 to 7 status. More...
 
uint32_t adc_get_value (volatile avr32_adc_t *adc, uint16_t channel)
 Get channel value. More...
 
void adc_start (volatile avr32_adc_t *adc)
 Start analog to digital conversion. More...
 

#define ADC_MAX_VALUE   0x3FF

Max value for ADC resolution.

bool adc_check_eoc ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Check channel conversion status.

Parameters
*adcBase address of the ADC
channelchannel to check (0 to 7)
Returns
bool true if conversion not running false if conversion running

References Assert.

Referenced by adc_get_value().

bool adc_check_ovr ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Check channel conversion overrun error.

Parameters
*adcBase address of the ADC
channelchannel to check (0 to 7)
Returns
bool FAIL if an error occurred PASS if no error occurred

References Assert, FAIL, and PASS.

void adc_configure ( volatile avr32_adc_t *  adc)

Configure ADC.

Mandatory to call. If not called, ADC channels will have side effects

Parameters
*adcBase address of the ADC

References Assert.

Referenced by acc_init().

void adc_disable ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Disable channel.

Parameters
*adcBase address of the ADC
channelchannel to disable (0 to 7)

References adc_get_status(), and Assert.

Referenced by acc_get_value().

void adc_enable ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Enable channel.

Parameters
*adcBase address of the ADC
channelchannel to enable (0 to 7)

References Assert.

Referenced by acc_get_value().

uint32_t adc_get_latest_value ( volatile avr32_adc_t *  adc)

Wait for the next converted data and return its value.

Parameters
*adcBase address of the ADC
Returns
The latest converted value (unsigned long)

References Assert.

bool adc_get_status ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Get channel 0 to 7 status.

Parameters
*adcBase address of the ADC
channelchannel to handle (0 to 7)
Returns
bool true if channel is enabled false if channel is disabled

References Assert.

Referenced by adc_disable().

uint32_t adc_get_value ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Get channel value.

Parameters
*adcBase address of the ADC
channelchannel to handle (0 to 7)
Returns
The value acquired (unsigned long)

References adc_check_eoc(), and Assert.

Referenced by acc_get_value().

void adc_start ( volatile avr32_adc_t *  adc)

Start analog to digital conversion.

Parameters
*adcBase address of the ADC

References Assert.

Referenced by acc_get_value().