/* [8017HW Library] Published: ICP DAS Library Version: V1.06 Released Author: Martin Released Date: 2008-11-20 Note1: This head file is the library definition of i-8017HW on WinPAC system Although i-8017H and i-8017HS are the same series as i-8017HW, i-8017H and i-8017HS can not work on WinPAC system. Library functions Descriptions: 1. Version information pac_i8017HW_GetLibVersion the version of library pac_i8017HW_GetLibDate the information of library built date pac_i8017HW_GetFirmwareVersion the version of firmware on i-8017HW 2. Initialize hardware pac_i8017HW_Init the function to initialize i-8017HW, this function must be called before using following functions. 3. Hardware indicator pac_i8017HW_GetSingleEndJumper the Single Ended/Differential Jumper indicator pac_i8017HW_SetLED the LED control function that is helpful for alarm indicator 4. Data acquisition pac_i8017HW_ReadAI this function can read the i-8017HW analog input data as float(engineering) format. pac_i8017HW_ReadHex this function can read the i-8017HW analog input data as hex(16 bit) format. Note: i-8017HW uses 14 bit AD chip, it is more convenient for pac_i8017h_ReadAIHex return 16 bit data when user need to scale the hex data. so it will have least two bit invalid data. user can use following statement to convert 16 bit data to 14 bit short Convert16To14( short bit16Data) { short bit14Data= bit16Data >> 2; bit14Data &= 0x3fff; return bit14Data; } */ #ifdef _8017H_EXPORTS #define I8017HWAPI __declspec(dllexport) #else #define I8017HWAPI __declspec(dllimport) #endif #ifdef __cplusplus extern "C" { #endif // Error Code Definition #define NoError 0 #define ID_ERROR -1 #define SLOT_ERROR -2 #define CHANNEL_ERROR -3 #define GAIN_ERROR -4 #define INT_MODE_ERROR -5 #define NOT_SUPPORT_ERROR -6 #define NOT_Calibration -7 // error code NOT_Calibration calibration means lib failed to read the calibration parameters from eeprom // this kind of error code aomethimes happened on CE platform at first slot of backplane. // normally, calibration ranges for 8017HW series are between 30000 ~ 38000, if failed to read the calibration from eeprom // the calibration parameters for gain will be 65535 (0xffff) #define Bad_Calibration -8 /* function to get the library version of i-8017HW /* /* return: version number. /* for example: 0x106; = Rev:1.0.6 */ I8017HWAPI short pac_i8017HW_GetLibVersion(void); /* function to get the library built date /* /* libDate: library built date /* return None */ I8017HWAPI void pac_i8017HW_GetLibDate(char libDate[]); //unsigned char -> char /* function to get the lattice version of i-8017h at specific slot /* /* iSlot: 0 ~ 7 /* return: Error code . /* */ I8017HWAPI short pac_i8017HW_GetFirmwareVersion(int iSlot,short* firmware); //not yet implemented, 2008/09/03 /* function to initialize i-8017h at specific slot /* /* iSlot: 0 ~ 7 /* return: Error Code. */ I8017HWAPI short pac_i8017HW_Init(int iSlot); /* function to get connector status between D sub and 8017DW (open or close) for i-8017DW at specific slot /* /* D Sub status: 1 means "Open"; 0 means "Close". /* iSlot: 0 ~ 7 /* return: Error code /* function for I-8017DW module only, in the others 8017 series module, /* the value of D Sub Status will always 1 (Open) */ I8017HWAPI short pac_i8017HW_Get_D_Sub_Status(int iSlot,short* D_Sub_Status); /* function to get the single ended/differential jumper status for i-8017h at specific slot /* /* selectJumper: 1 Single Ended; 0 Differential. /* iSlot: 0 ~ 7 /* return: Error code */ I8017HWAPI short pac_i8017HW_GetSingleEndJumper(int iSlot,short* selectJumper); /* function to get the calibrated gain and offset value for i-8017h at specific slot for certain input range /* /* iSlot: 0 ~ 7 /* iGain: /* 0: +/- 10.0V /* 1: +/- 5.0V /* 2: +/- 2.5V /* 3: +/- 1.25V /* 4: +/- 20mA /* iGainValue: the calibated gain value /* iOffsetValue: the calibated offset value /* /* return: Error code */ I8017HWAPI short pac_i8017HW_ReadGainOffset_Info(int iSlot,int iGain,unsigned short* iGainValue,short* iOffsetValue); /* function to have programmable LED control for i-8017h at specific slot /* /* iSlot: 0 ~ 7 /* iLedValue: 0 ~ 0xffff /* /* return: Error code */ I8017HWAPI short pac_i8017HW_SetLED(int iSlot,unsigned short iLedValue); /* function to read float format analog input data from i-8017h at specific slot /* /* iSlot: 0 ~ 7 /* iChannel: 0 ~ 7 if Differential mode; 0 ~ 15 if Single Ended mode /* iGain: /* 0: +/- 10.0V /* 1: +/- 5.0V /* 2: +/- 2.5V /* 3: +/- 1.25V /* 4: +/- 20mA /* fValue: float format analog input data. /* /* return: Error code */ I8017HWAPI short pac_i8017HW_ReadAI(int iSlot,int iChannel,int iGain,float* fValue); /* function to read float format analog input data from i-8017h at specific slot /* /* iSlot: 0 ~ 7 /* iChannel: 0 ~ 7 if Differential mode; 0 ~ 15 if Single Ended mode /* iGain: /* 0: +/- 10.0V /* 1: +/- 5.0V /* 2: +/- 2.5V /* 3: +/- 1.25V /* 4: +/- 20mA /* fValue: float format analog input data. /* /* return: Error code */ I8017HWAPI short pac_i8017HW_ReadAI_AVG(int slot,int iChannel,int iGain,unsigned short averageCnt,float* fValue); /* function to read 16 bit hex format analog input data from i-8017h at specific slot /* /* iSlot: 0 ~ 7 /* iChannel: 0 ~ 7 if Differential mode; 0 ~ 15 if Single Ended mode /* iGain: /* 0: +/- 10.0V /* 1: +/- 5.0V /* 2: +/- 2.5V /* 3: +/- 1.25V /* 4: +/- 20mA /* averageCnt: the average count for each sampling routine. /* iValue: 16 bit hex format analog input data. /* /* return: Error code */ I8017HWAPI short pac_i8017HW_ReadAIHex(int iSlot,int iChannel,int iGain,short* iValue); /* function to read average value for 16 bit hex format analog input data from i-8017h at specific slot /* /* iSlot: 0 ~ 7 /* iChannel: 0 ~ 7 if Differential mode; 0 ~ 15 if Single Ended mode /* iGain: /* 0: +/- 10.0V /* 1: +/- 5.0V /* 2: +/- 2.5V /* 3: +/- 1.25V /* 4: +/- 20mA /* averageCnt: the average count for each sampling routine. /* iValue: 16 bit hex format analog input data. /* /* return: Error code */ I8017HWAPI short pac_i8017HW_ReadAIHex_AVG(int slot,int iChannel,int iGain,unsigned short averageCnt,short* iValue); //I8017HWAPI void pac_i8017HW_Set_MUXReadyTime(int delayTime); //I8017HWAPI short pac_i8017HW_Get_MUXReadyTime(void); #ifdef __cplusplus } #endif