adc.h File Reference

The header file describes the ADC interface. More...

#include <types.h>

Go to the source code of this file.

Data Structures

struct  HAL_AdcParams_t
 adc structure of parameters More...

Defines

#define RESOLUTION_8_BIT   0
 adc resolution
#define RESOLUTION_10_BIT   1

Enumerations

enum  HAL_AdcVoltageReference_t { AREF = (0 << 6), AVCC = (1 << 6), INTERNAL_1d1V = (2 << 6), INTERNAL_2d56V = (3 << 6) }
 adc sample rate adc voltage reference More...

Functions

int HAL_OpenAdc (HAL_AdcParams_t *param)
 channel number.
Note for avr: If 10x gain is used, 8 bit resolution can be expected.
If 200x gain is used, 7 bit resolution can be expected.
If the user wants to perform a quick polarity check of the result,
it is sufficient to read the MSB of the result. If the bit is one,
the result is negative, and if this bit is zero, the result is positive.
To reach the given accuracy, 10x or 200x Gain should not be used
for operating voltage below 2.7V. Opens the ADC to make the measurement on the ADC channel.
int HAL_ReadAdc (HAL_AdcChannelNumber_t channel)
 Starts ADC with the parameters defined in HAL_OpenAdc.
int HAL_CloseAdc (void)
 Closes the ADC.


Detailed Description

The header file describes the ADC interface.

Author:
Atmel Corporation: http://www.atmel.com
Support email: avr@atmel.com
Copyright (c) 2008 , Atmel Corporation. All rights reserved. Licensed under Atmel's Limited License Agreement (BitCloudTM).

Definition in file adc.h.


Define Documentation

#define RESOLUTION_8_BIT   0

adc resolution

Definition at line 28 of file adc.h.

#define RESOLUTION_10_BIT   1

Definition at line 29 of file adc.h.


Enumeration Type Documentation

enum HAL_AdcVoltageReference_t

adc sample rate adc voltage reference

Enumerator:
AREF  AREF, Internal Vref turned off.
If 10x or 200x gain is selected, only 2.56 V should be used as Internal Voltage Reference.
For differential conversion, only 1.1V cannot be used as internal voltage reference.
AVCC  AVCC with external capacitor at AREF pin.
INTERNAL_1d1V  Internal 1.1V Voltage Reference with external capacitor at AREF pin.
INTERNAL_2d56V  Internal 2.56V Voltage Reference with external capacitor at AREF pin.

Definition at line 62 of file adc.h.


Function Documentation

int HAL_OpenAdc ( HAL_AdcParams_t param  ) 

channel number.
Note for avr: If 10x gain is used, 8 bit resolution can be expected.
If 200x gain is used, 7 bit resolution can be expected.
If the user wants to perform a quick polarity check of the result,
it is sufficient to read the MSB of the result. If the bit is one,
the result is negative, and if this bit is zero, the result is positive.
To reach the given accuracy, 10x or 200x Gain should not be used
for operating voltage below 2.7V. Opens the ADC to make the measurement on the ADC channel.

Parameters:
[in] param - address of HAL_AdcParams_t structure.
fields of structure set by user:
resolution - conversion resolution. Must be chosen from:
RESOLUTION_8_BIT
RESOLUTION_10_BIT
sampleRate - sample rate. Must be chosen from:
for avr hardware platform
ADC_77KSPS
ADC_39KSPS
ADC_19200SPS
ADC_9600SPS
ADC_4800SPS
for arm hardware platform
ADC_533KSPS
ADC_429KSPS
ADC_369KSPS
ADC_250KSPS
ADC_136KSPS
ADC_68KSPS
ADC_34KSPS
bufferPointer - pointer to the application data buffer.
Buffer cell is one byte for 8-bit resolution.
Buffer cell is two bytes for 10-bit resolution.
selectionsAmount - amount of samples (buffer cells).
callback - pointer to the function that will notify about measurement completion.
Returns:
-1 - unsupported parameter or ADC is busy.
0 - success.

int HAL_ReadAdc ( HAL_AdcChannelNumber_t  channel  ) 

Starts ADC with the parameters defined in HAL_OpenAdc.

Parameters:
[in] channel - number of ADC channel. Must be chosen from:
HAL_ADC_CHANNEL0
HAL_ADC_CHANNEL1
HAL_ADC_CHANNEL2
HAL_ADC_CHANNEL3
next four channels only for arm hardware platform
HAL_ADC_CHANNEL4
HAL_ADC_CHANNEL5
HAL_ADC_CHANNEL6
HAL_ADC_CHANNEL7
next eight channels only for avr hardware platform
HAL_ADC_DIFF_CHANNEL0
HAL_ADC_DIFF_CHANNEL1
HAL_ADC_DIFF_CHANNEL2
HAL_ADC_DIFF_CHANNEL3
HAL_ADC_DIFF_CHANNEL4
HAL_ADC_DIFF_CHANNEL5
HAL_ADC_DIFF_CHANNEL6
HAL_ADC_DIFF_CHANNEL7
Returns:
-1 - unable to open ADC (unsupported channel number).
0 - success.

int HAL_CloseAdc ( void   ) 

Closes the ADC.

Returns:
-1 - the module was not open.
0 - success.


Generated on Mon Feb 16 17:53:40 2009 for BitCloud Stack Documentation by  doxygen 1.5.1-p1