hdo  beta
Definice maker | Funkce
Dokumentace souboru /home/mrazik/Documents/web/old/hdo/at91lib/peripherals/adc/adc.h

Zobrazit zdrojový text tohoto souboru.

Definice maker

#define ADC_CHANNEL_0   0
#define ADC_CHANNEL_1   1
#define ADC_CHANNEL_2   2
#define ADC_CHANNEL_3   3
#define ADC_CHANNEL_4   4
#define ADC_CHANNEL_5   5
#define ADC_CHANNEL_6   6
#define ADC_CHANNEL_7   7

Funkce

void ADC_Initialize (AT91S_ADC *pAdc, unsigned char idAdc, unsigned char trgEn, unsigned char trgSel, unsigned char sleepMode, unsigned char resolution, unsigned int mckClock, unsigned int adcClock, unsigned int startupTime, unsigned int sampleAndHoldTime)
unsigned int ADC_GetModeReg (AT91S_ADC *pAdc)
void ADC_EnableChannel (AT91S_ADC *pAdc, unsigned int channel)
void ADC_DisableChannel (AT91S_ADC *pAdc, unsigned int channel)
unsigned int ADC_GetChannelStatus (AT91S_ADC *pAdc)
void ADC_StartConversion (AT91S_ADC *pAdc)
void ADC_SoftReset (AT91S_ADC *pAdc)
unsigned int ADC_GetLastConvertedData (AT91S_ADC *pAdc)
unsigned int ADC_GetConvertedData (AT91S_ADC *pAdc, unsigned int channel)
void ADC_EnableIt (AT91S_ADC *pAdc, unsigned int flag)
void ADC_EnableDataReadyIt (AT91S_ADC *pAdc)
void ADC_DisableIt (AT91S_ADC *pAdc, unsigned int flag)
unsigned int ADC_GetStatus (AT91S_ADC *pAdc)
unsigned int ADC_GetInterruptMaskStatus (AT91S_ADC *pAdc)
unsigned int ADC_IsInterruptMasked (AT91S_ADC *pAdc, unsigned int flag)
unsigned int ADC_IsStatusSet (AT91S_ADC *pAdc, unsigned int flag)
unsigned char ADC_IsChannelInterruptStatusSet (unsigned int adc_sr, unsigned int channel)

Detailní popis

Purpose

Interface for configuration the Analog-to-Digital Converter (ADC) peripheral.

Usage

  1. Configurate the pins for ADC
  2. Initialize the ADC with ADC_Initialize().
  3. Select the active channel using ADC_EnableChannel()
  4. Start the conversion with ADC_StartConversion()

Definice v souboru adc.h.


Dokumentace funkcí

void ADC_DisableChannel ( AT91S_ADC pAdc,
unsigned int  channel 
)

Disable Channel

Parametry:
pAdcPointer to an AT91S_ADC instance.
channelchannel to disable

Definice je uvedena na řádku 161 v souboru adc.c.

Odkazuje se na ASSERT.

void ADC_DisableIt ( AT91S_ADC pAdc,
unsigned int  flag 
)

Disable ADC interrupt

Parametry:
pAdcPointer to an AT91S_ADC instance.
flagIT to be disabled

Definice je uvedena na řádku 276 v souboru adc.c.

Odkazuje se na ASSERT.

void ADC_EnableChannel ( AT91S_ADC pAdc,
unsigned int  channel 
)

Enable Channel

Parametry:
pAdcPointer to an AT91S_ADC instance.
channelchannel to enable

Definice je uvedena na řádku 149 v souboru adc.c.

Odkazuje se na ASSERT.

void ADC_EnableDataReadyIt ( AT91S_ADC pAdc)

Enable ADC Data Ready interrupt

Parametry:
pAdcPointer to an AT91S_ADC instance.

Definice je uvedena na řádku 267 v souboru adc.c.

void ADC_EnableIt ( AT91S_ADC pAdc,
unsigned int  flag 
)

Enable ADC interrupt

Parametry:
pAdcPointer to an AT91S_ADC instance.
flagIT to be enabled

Definice je uvedena na řádku 247 v souboru adc.c.

Odkazuje se na ASSERT.

unsigned int ADC_GetChannelStatus ( AT91S_ADC pAdc)

Return chanel status

Parametry:
pAdcPointer to an AT91S_ADC instance.
Návratová hodnota:
ADC Channel Status Register

Definice je uvedena na řádku 173 v souboru adc.c.

unsigned int ADC_GetConvertedData ( AT91S_ADC pAdc,
unsigned int  channel 
)

Return the Channel Converted Data

Parametry:
pAdcPointer to an AT91S_ADC instance.
channelchannel to get converted value
Návratová hodnota:
Channel converted data of the specified channel

Definice je uvedena na řádku 208 v souboru adc.c.

Odkazuje se na ASSERT.

unsigned int ADC_GetInterruptMaskStatus ( AT91S_ADC pAdc)

Return ADC Interrupt Mask Status

Parametry:
pAdcPointer to an AT91S_ADC instance.
Návratová hodnota:
ADC Interrupt Mask Register

Definice je uvedena na řádku 306 v souboru adc.c.

unsigned int ADC_GetLastConvertedData ( AT91S_ADC pAdc)

Return the Last Converted Data

Parametry:
pAdcPointer to an AT91S_ADC instance.
Návratová hodnota:
Last Converted Data

Definice je uvedena na řádku 198 v souboru adc.c.

unsigned int ADC_GetModeReg ( AT91S_ADC pAdc)

Return the Mode Register of the ADC controller value

Parametry:
pAdcPointer to an AT91S_ADC instance.
Návratová hodnota:
ADC Mode register

Definice je uvedena na řádku 140 v souboru adc.c.

unsigned int ADC_GetStatus ( AT91S_ADC pAdc)

Return ADC Interrupt Status

Parametry:
pAdcPointer to an AT91S_ADC instance.
Návratová hodnota:
ADC Stats register

Definice je uvedena na řádku 297 v souboru adc.c.

void ADC_Initialize ( AT91S_ADC pAdc,
unsigned char  idAdc,
unsigned char  trgEn,
unsigned char  trgSel,
unsigned char  sleepMode,
unsigned char  resolution,
unsigned int  mckClock,
unsigned int  adcClock,
unsigned int  startupTime,
unsigned int  sampleAndHoldTime 
)

Initialize the ADC controller

Parametry:
pAdcPointer to an AT91S_ADC instance.
idAdc???
trgEntrigger mode, software or Hardware
trgSelhardware trigger selection
sleepModesleep mode selection
resolutionresolution selection 8 bits or 10 bits
mckClockvalue of MCK in Hz
adcClockvalue of the ADC clock in Hz
startupTimevalue of the start up time (in �s) (see datasheet)
sampleAndHoldTime(in ns)
 Example:
 5 MHz operation, 20�s startup time, 600ns track and hold time
 PRESCAL: Prescaler Rate Selection ADCClock = MCK / ( (PRESCAL+1) * 2 )
 PRESCAL = [MCK / (ADCClock * 2)] -1 = [48/(5*2)]-1 = 3,8
 PRESCAL =  4 -> 48/((4+1)*2) = 48/10 = 4.8MHz
 48/((3+1)*2) = 48/8 = 6MHz
 Startup Time = (STARTUP+1) * 8 / ADCClock
 STARTUP = [(Startup Time * ADCClock)/8]-1 = [(20 10e-6 * 5000000)/8]-1 = 11,5
 STARTUP = 11 -> (11+1)*8/48000000 = 96/4800000 = 20�s

 Sample & Hold Time = (SHTIM+1) / ADCClock
 SHTIM = (HoldTime * ADCClock)-1 = (600 10e-9 * 5000000)-1 = 2
 SHTIM   =  2 -> (2+1)/4800000 = 1/1200000 = 833ns

Definice je uvedena na řádku 70 v souboru adc.c.

Odkazuje se na ADC_Initialize(), ADC_STARTUP_TIME_MAX, ADC_TRACK_HOLD_TIME_MIN, ASSERT a TRACE_DEBUG.

Používá se v ADC_Initialize() a main().

unsigned char ADC_IsChannelInterruptStatusSet ( unsigned int  adc_sr,
unsigned int  channel 
)

Test if ADC channel interrupt Status is Set

Parametry:
adc_srValue of SR register
channelChannel to be tested
Návratová hodnota:
1 if interrupt status is set, otherwise 0

Definice je uvedena na řádku 337 v souboru adc.c.

unsigned int ADC_IsInterruptMasked ( AT91S_ADC pAdc,
unsigned int  flag 
)

Test if ADC Interrupt is Masked

Parametry:
pAdcPointer to an AT91S_ADC instance.
flagflag to be tested
Návratová hodnota:
1 if interrupt is masked, otherwise 0

Definice je uvedena na řádku 316 v souboru adc.c.

unsigned int ADC_IsStatusSet ( AT91S_ADC pAdc,
unsigned int  flag 
)

Test if ADC Status is Set

Parametry:
pAdcPointer to an AT91S_ADC instance.
flagflag to be tested
Návratová hodnota:
1 if the staus is set; 0 otherwise

Definice je uvedena na řádku 326 v souboru adc.c.

void ADC_SoftReset ( AT91S_ADC pAdc)

Software reset

Parametry:
pAdcPointer to an AT91S_ADC instance.

Definice je uvedena na řádku 189 v souboru adc.c.

void ADC_StartConversion ( AT91S_ADC pAdc)

Software request for a analog to digital conversion

Parametry:
pAdcPointer to an AT91S_ADC instance.

Definice je uvedena na řádku 181 v souboru adc.c.