adc.c File Reference
#include "adc.h"
#include "TIMotorLIB.h"
#include <math.h>
#include "IQmathLib.h"
#include "SFO_V5.h"
#include "IQConstants.h"
#include "adc.h"
#include "Utils.h"
#include "Constants.h"
#include "QDOperations.h"
#include "FilterAndRotations.h"
#include "DSP2833x_Device.h"
#include "DataStorage.h"
#include "cpu.h"
Go to the source code of this file.
Defines |
#define | ADC_usDELAY 5000L |
Functions |
static void | CalculateADClocks (_iq fAD, Uint16 tSH, volatile Uint16 *adcCLKPS, volatile Uint16 *cps, volatile Uint16 *acq_ps) |
void | ConfigureAD (void(*interruptFCN)(void), _iq fAD, Uint16 tSH, SEQ_MODE seqMode, SAMPLING_MODE samplingMode, SOC_MODE socMode, Uint16 offtrim) |
void | AddChannel (Uint16 input, Uint16 canal, _iq offset, _iq gain) |
void | AddUnipolarChannel (Uint16 input, Uint16 channel, _iq offset, _iq gain) |
void | InitAD (void) |
| Initializes AD circuits.
|
void | InitADPeripheralClocks (void) |
| Initializes AD clock.
|
Variables |
struct ADConfiguration | adConfiguration |
Define Documentation
#define ADC_usDELAY 5000L |
Definition at line 28 of file adc.c.
Function Documentation
void AddChannel |
( |
Uint16 |
input, |
|
|
Uint16 |
channel, |
|
|
_iq |
offset, |
|
|
_iq |
gain | |
|
) |
| | |
void AddUnipolarChannel |
( |
Uint16 |
input, |
|
|
Uint16 |
channel, |
|
|
_iq |
offset, |
|
|
_iq |
gain | |
|
) |
| | |
Add unipolar channel to the AD module.
- Parameters:
-
| input | input number (ADCINA0...ADCINA7, ADCINB0...ADCINB7) |
| channel | set the S/H channel associated to the input. |
| offset | offset in physical units |
| gain | units/bits gain |
Definition at line 154 of file adc.c.
static void CalculateADClocks |
( |
_iq |
fAD, |
|
|
Uint16 |
tSH, |
|
|
volatile Uint16 * |
adcCLKPS, |
|
|
volatile Uint16 * |
cps, |
|
|
volatile Uint16 * |
acq_ps | |
|
) |
| | [inline, static] |
Calculate needed prescaler values (cps, acq_ps) for the given frequency (fAD [Mhz]) and sampling time (tSH [ns])
Definition at line 34 of file adc.c.
void ConfigureAD |
( |
void(*)(void) |
interruptFCN, |
|
|
_iq |
fAD, |
|
|
Uint16 |
tSH, |
|
|
SEQ_MODE |
seqMode, |
|
|
SAMPLING_MODE |
samplingMode, |
|
|
SOC_MODE |
socMode, |
|
|
Uint16 |
offtrim | |
|
) |
| | |
Configure AD module.
- Parameters:
-
| interruptFCN | pointer to interrupt routine called on A/D finished conversion. If not desired pass NULL. |
| fAD | desired AD clock in Mhz |
| tSH | desired SH acquisition time in ns |
| seqMode | INDEPENDENT_SEQ_MODE or CASCADED_SEQ_MODE. |
| samplingMode | CASCADED_MODE or SIMULTANEOUS_MODE |
| socMode,: | start of conversion modes PWM_SOC (start of conversion by pwm), GPIO_SOC (start of conversion by external GPIO) or SW_SOC (start of conversion by software) |
| offtrim | AD offset compensation |
- Examples:
- TIMotorLIBExample1/main.c, TIMotorLIBExample2/main.c, TIMotorLIBExample3/main.c, TIMotorLIBExampleHrdw/main.c, and TIMotorLIBExampleSw/main.c.
Definition at line 55 of file adc.c.
Initializes AD circuits.
Definition at line 163 of file adc.c.
void InitADPeripheralClocks |
( |
void |
|
) |
|
Initializes AD clock.
Definition at line 176 of file adc.c.
Variable Documentation
Definition at line 30 of file adc.c.