www.pudn.com > DSP2812formotorcontrol.rar > DSP281x_ADC04U.h


/* ================================================================================== 
File name:       DSP281x_ADC04U.H 
                     
Originator:	Digital Control Systems Group 
			Texas Instruments 
 
Description: This header file contains source for the F281X general purpose  
4 conversions ADC driver for unipolar signals 
 
Target: TMS320F281x family 
 
===================================================================================== 
History: 
------------------------------------------------------------------------------------- 
 04-15-2005	Version 3.20: Using DSP281x v. 1.00 or higher  
----------------------------------------------------------------------------------*/ 
 
#ifndef __DSP281X_ADC04U_H__ 
#define __DSP281X_ADC04U_H__ 
 
#include "DSP281x_BMSK.h" 
 
/*----------------------------------------------------------------------------- 
Define the structure of the ADCVALS Object 
-----------------------------------------------------------------------------*/ 
typedef struct { int16 Ch1Gain;        // Parameter: Gain for channel 1 (Q13)  
                 int16 Ch1Out;         // Output: Channel 1 output (Q15)  
                 int16 Ch2Gain;        // Parameter: Gain for channel 2 (Q13)  
                 int16 Ch2Out;         // Output: Channel 2 output (Q15)  
                 int16 Ch3Gain;        // Parameter: Gain for channel 3 (Q13)  
                 int16 Ch3Out;         // Output: Channel 3 output (Q15)  
                 int16 Ch4Gain;        // Parameter: Gain for channel 4 (Q13) 
                 int16 Ch4Out;         // Output: Channel 4 output (Q15) 
                 Uint16 ChSelect;      // Parameter: ADC channel selection 
                 void (*init)();       // Pointer to the init function  
                 void (*read)();       // Pointer to the read function  
               } ADCVALS; 
 
typedef ADCVALS *ADCVALS_handle; 
/*----------------------------------------------------------------------------- 
 Note 1 : It is necessary to call the init function to change the ADC  
            register settings, for the change in the channel setting for  
            Ch_sel setting changes to take effect. 
            The read function will not detect or act upon this change. 
-----------------------------------------------------------------------------*/ 
// Default Initializer for the ADCVALS Object 
 
#define F281X_ADC04U_DEFAULTS { 0x1FFF,0x0000,             \ 
                                0x1FFF,0x0000,             \ 
                                0x1FFF,0x0000,             \ 
                                0x1FFF,0x0000,             \ 
                                0x6543,                    \ 
                              (void (*)(Uint32))F281X_adc04u_drv_init, \ 
                              (void (*)(Uint32))F281X_adc04u_drv_read  \ 
                             } 
 
#define ADCVALS_DEFAULTS F281X_ADC04U_DEFAULTS  
 
#define ADCTRL1_INIT_STATE_UNIPOLAR  ADC_SUS_MODE0 + ADC_ACQ_PS_2 + \ 
                                     ADC_CPS_1 + ADC_SEQ_CASC 
 
#define ADCTRL2_INIT_STATE_UNIPOLAR  ADC_EVA_SOC_SEQ1  
 
/*------------------------------------------------------------------------------ 
 Prototypes for the functions in F281XADC04U.C 
------------------------------------------------------------------------------*/ 
void F281X_adc04u_drv_init(ADCVALS *); 
void F281X_adc04u_drv_read(ADCVALS *); 
 
#endif // __DSP281X_ADC04U_H__