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
- Configurate the pins for ADC
- Initialize the ADC with ADC_Initialize().
- Select the active channel using ADC_EnableChannel()
- Start the conversion with ADC_StartConversion()
Definice v souboru adc.h.
Dokumentace funkcí
Disable Channel
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
channel | channel to disable |
Definice je uvedena na řádku 161 v souboru adc.c.
Odkazuje se na ASSERT.
Disable ADC interrupt
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
flag | IT to be disabled |
Definice je uvedena na řádku 276 v souboru adc.c.
Odkazuje se na ASSERT.
Enable Channel
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
channel | channel to enable |
Definice je uvedena na řádku 149 v souboru adc.c.
Odkazuje se na ASSERT.
Enable ADC Data Ready interrupt
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
Definice je uvedena na řádku 267 v souboru adc.c.
Enable ADC interrupt
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
flag | IT to be enabled |
Definice je uvedena na řádku 247 v souboru adc.c.
Odkazuje se na ASSERT.
Return chanel status
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
- Návratová hodnota:
- ADC Channel Status Register
Definice je uvedena na řádku 173 v souboru adc.c.
Return the Channel Converted Data
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
channel | channel 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.
Return ADC Interrupt Mask Status
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
- Návratová hodnota:
- ADC Interrupt Mask Register
Definice je uvedena na řádku 306 v souboru adc.c.
Return the Last Converted Data
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
- Návratová hodnota:
- Last Converted Data
Definice je uvedena na řádku 198 v souboru adc.c.
Return the Mode Register of the ADC controller value
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
- Návratová hodnota:
- ADC Mode register
Definice je uvedena na řádku 140 v souboru adc.c.
Return ADC Interrupt Status
- Parametry:
-
pAdc | Pointer 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:
-
pAdc | Pointer to an AT91S_ADC instance. |
idAdc | ??? |
trgEn | trigger mode, software or Hardware |
trgSel | hardware trigger selection |
sleepMode | sleep mode selection |
resolution | resolution selection 8 bits or 10 bits |
mckClock | value of MCK in Hz |
adcClock | value of the ADC clock in Hz |
startupTime | value 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().
Test if ADC channel interrupt Status is Set
- Parametry:
-
adc_sr | Value of SR register |
channel | Channel to be tested |
- Návratová hodnota:
- 1 if interrupt status is set, otherwise 0
Definice je uvedena na řádku 337 v souboru adc.c.
Test if ADC Interrupt is Masked
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
flag | flag to be tested |
- Návratová hodnota:
- 1 if interrupt is masked, otherwise 0
Definice je uvedena na řádku 316 v souboru adc.c.
Test if ADC Status is Set
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
flag | flag to be tested |
- Návratová hodnota:
- 1 if the staus is set; 0 otherwise
Definice je uvedena na řádku 326 v souboru adc.c.
Software reset
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
Definice je uvedena na řádku 189 v souboru adc.c.
Software request for a analog to digital conversion
- Parametry:
-
pAdc | Pointer to an AT91S_ADC instance. |
Definice je uvedena na řádku 181 v souboru adc.c.