/************************/
/*  head file for 8024  */
/************************/
/*
Ver 2.0.0 [7,Oct,2004] by Bill
    1.Remove smoe function that useless for user.
      Such as:  
                void write_93c46(int slot,int addr,int data);
                int read_93c46(int slot,int addr);           
                void erase_93c46(int slot,int addr);         
              
    2.Change functions name:                               
          pac_i8024_VoltageHexOut ==> pac_i8024_VoltageOut_Hex
          pac_i8024_CurrentHexOut ==> pac_i8024_CurrentOut_Hex
*/    

/************************************************************************/
/*  	[8024 D/A chip specific]			                            */
/*      Voltage Output range:           -10.0V     0V        +10.0V     */
/*          (1)float format             -10.0V   0.0V        +10.0V     */
/*          (2)Hex format              -32768      0         32767      */
/*          (3)interger format(mv)     -10000mV    0mV      +10000mV    */
/*                                                                      */
/*      CurrentOutput range:                     0.0mA       +20.0mA    */
/*          (1)float format                      0.0mA       +20.0mA    */
/*          (2)Hex format                          0         32768      */
/*          (3)interger format(0.001mA)            0         20000mA    */
/************************************************************************/
#ifdef _8024_EXPORTS
	#define I8024W_API __declspec(dllexport) 
#else
	#define I8024W_API __declspec(dllimport) 
#endif

#define NoError 				0
#define ID_ERROR				-1

#ifdef __cplusplus
extern "C" {
#endif


#define I9024_GetFirmwareVersion       I8024_GetFirmwareVersion
#define I9024_GetLibVersion            I8024_GetLibVersion
#define I9024_ReadGainOffsetInfo       I8024_ReadGainOffsetInfo
#define I9024_ReadVoltageGain          I8024_ReadVoltageGain
#define I9024_ReadCurrentGain          I8024_ReadCurrentGain
#define I9024_Initial                  I8024_Initial
#define I9024_VoltageOut               I8024_VoltageOut
#define I9024_VoltageOut_Hex           I8024_VoltageOut_Hex
#define I9024_CurrentOut               I8024_CurrentOut
#define I9024_CurrentOut_Hex           I8024_CurrentOut_Hex
#define I9024_VoltageOut_Readback      I8024_VoltageOut_Readback   
#define I9024_VoltageOut_Hex_Readback  I8024_VoltageOut_Hex_Readback
#define I9024_CurrentOut_Readback      I8024_CurrentOut_Readback
#define I9024_CurrentOut_Hex_Readback  I8024_CurrentOut_Hex_Readback


short I8024_GetFirmwareVersion(int iSlot);
short I8024_GetLibVersion(void);
//void I8024_GetLibDate(char libDate[]);
void I8024_ReadGainOffsetInfo(int slot, int ch, int type, float *gain, float* offset);
void I8024_ReadVoltageGain(int slot,int ch,int* vMax,int* vMin);
void I8024_ReadCurrentGain(int slot,int ch,int* iMax,int* iMin);
short I8024_Initial(int Slot);

/*
For I-8024 use 14-bit DA chip, but for all hex output/readback API function, 
we use 16-bit as output hex data, 
for example:
iChipData is 16-bit hex data will be used as output data 
the iChipData will be converted to 14-bit data before output to DA Chip

    Lbyte = iChipData & 0xff;
    Hbyte = iChipData >> 8;
    Hbyte = Hbyte & 0x3f;

            Range with 16 bits of 2's complement:
            Voltage:
            -32768           -0     +0           32767
             -10V            0V     0V            +10V
                                                           (New)     
            Current:
               0            32768
               0             20mA
            ******************************************
            Range of general 14 bits:
            Voltage:
               0            8192            16383
             -10V            0               10V 
                                                           (Old)            
            Current:
              8192          16383
               0             20mA 
*/

//Voltage output
void I8024_VoltageOut(int slot,int ch,float fData);
//fData: -10.0 ~ +10.0

void I8024_VoltageOut_Hex(int slot,int ch,int hData);
//iData: -32768  ~  +32767

//Current
void I8024_CurrentOut(int slot,int ch,float fData);
//fData:  0.0 ~ +20.0 

void I8024_CurrentOut_Hex(int slot,int ch,int hData);
//iData: 0  ~  +32767

//Voltage output readback (software readback)
float I8024_VoltageOut_Readback(int slot,int ch);
//fData: -10.0 ~ +10.0

int I8024_VoltageOut_Hex_Readback(int slot,int ch);
//iData: -32768  ~  +32767

float I8024_CurrentOut_Readback(int slot,int ch);
//fData:  0.0 ~ +20.0 

int I8024_CurrentOut_Hex_Readback(int slot,int ch);
//iData: 0  ~  +32767

#ifdef __cplusplus
 }
#endif
