// pac_i8014W_ReadFIFO_BlockMode add when Ver 1.0.0.9 // pac_i8014W_ReadFIFO_InISR add when Ver 1.0.0.9 #ifdef __cplusplus extern "C" { #endif #ifdef _8014W_EXPORTS #define I8014WAPI __declspec(dllexport) #else #define I8014WAPI __declspec(dllimport) #endif #define NoError 0 #define ID_ERROR -1 #define SLOT_ERROR -2 #define CHANNEL_ERROR -3 #define GAIN_ERROR -4 #define FIFO_EMPTY -5 #define FIFO_LATCHED -6 #define FIFO_OVERFLOW -7 #define TX_NOTREADY -8 #define FIFO_ISR_ERROR -9 #define REG_SLOT_ISR_ERROR -100 #define MAX_FIFO 4096 I8014WAPI short pac_i8014W_Init(int slot); // function to initialize i-8014W at specific slot // slot: 0 ~ 7 // return: Error Code. I8014WAPI short pac_i8014W_GetLibVersion(void); // function to get the library version of i-8014W // return: version number. // for example: 0x106; = Rev:1.0.6 I8014WAPI void pac_i8014W_GetLibDate(char libDate[]); // function to get the library built date // libDate: library built date // return: None I8014WAPI short pac_i8014W_GetFirmwareVer_L1(int slot); // function to get the first FPGA firmware version // slot: 0 ~ 7 // return: firmware version I8014WAPI short pac_i8014W_GetFirmwareVer_L2(int slot); // function to get the second FPGA firmware version // slot: 0 ~ 7 // return: firmware version I8014WAPI short pac_i8014W_GetSingleEndJumper(int slot); // function to detection single-ended/differential jumper status // slot: 0 ~ 7 // return: 0 : differential 1 : single-ended I8014WAPI void pac_i8014W_ReadGainOffset(int slot,short gain,unsigned short* gainValue, short* offsetValue); // for I-8014W / I-9014 // function to read gain value and offset value for each range of I-8014 / I-9014 // slot: 0 ~ 7 // gain: 0 : +/- 10V 1 : +/- 5V 2 : +/- 2.5V 3 : +/- 1.25V 4 : +/- 20mA // *gainValue: gain value // *offsetValue: offset value // return: None I8014WAPI void pac_i8014W_CalibrateDataHex(int slot, short iGain,short dataFromFIFO, short* calibratedAI); // for I-8014W / I-9014 // function to calibrate the raw data read from magic scan // slot: 0 ~ 7 // iGain: 0 : +/- 10V 1 : +/- 5V 2 : +/- 2.5V 3 : +/- 1.25V 4 : +/- 20mA // dataFromFIFO: data need to calibrate // *calibratedAI: calibrated hexadecimal format data // return: None I8014WAPI void pac_i8014W_CalibrateData(int slot, short iGain,short dataFromFIFO, float* calibratedAI); // for I-8014W / I-9014 // function to calibrate the raw data read from magic scan // slot: 0 ~ 7 // iGain: 0 : +/- 10V 1 : +/- 5V 2 : +/- 2.5V 3 : +/- 1.25V 4 : +/- 20mA // dataFromFIFO: data need to calibrate // *calibratedAI: calibrated float format data // return: None I8014WAPI void pac_i8014W_Read_mA_GainOffset(int slot,short ch ,unsigned short* GainValue, short* offsetValue); // for I-8014CW / I-9014C // function to read gain value and offset value for each channel of I-8014CW / I-9014C // slot: 0 ~ 7 // ch: 0 ~ 7 (+/- 20mA) // *GainValue: gain value // *offsetValue: offset value // return: None I8014WAPI void pac_i8014W_Calibrate_CH_mA_Hex(int slot, int ch ,short dataFromFIFO, short* calibratedAI); // for I-8014CW / I-9014C // function to calibrate the raw data read from magic scan // slot: 0 ~ 7 // ch: 0 ~ 7 (+/- 20mA) // dataFromFIFO: data need to calibrate // *calibratedAI: calibrated hexadecimal format data // return: None I8014WAPI void pac_i8014W_Calibrate_CH_mA(int slot, int ch ,short dataFromFIFO, float* calibratedAI); // for I-8014CW / I-9014C // function to calibrate the raw data read from magic scan // slot: 0 ~ 7 // ch: 0 ~ 7 (+/- 20mA) // dataFromFIFO: data need to calibrate // *calibratedAI: calibrated float format data // return: None I8014WAPI short pac_i8014W_ReadAIHex(int slot,short ch,short gain, short* hVal); // function to read calibrated AI data // slot: 0 ~ 7 // ch: 0 ~ 7 // gain: I-8014W / I-9014 0 : +/- 10V 1 : +/- 5V 2 : +/- 2.5V 3 : +/- 1.25V 4 : +/- 20mA // I-8014CW / I-9014C 4 : +/- 20mA // hVal: calibrated hexadecimal format data // return: refer to error code I8014WAPI short pac_i8014W_ReadAI(int slot,short ch,short gain, float* fVal); // function to read calibrated AI data // slot: 0 ~ 7 // ch: 0 ~ 7 // gain: I-8014W / I-9014 0 : +/- 10V 1 : +/- 5V 2 : +/- 2.5V 3 : +/- 1.25V 4 : +/- 20mA // I-8014CW / I-9014C 4 : +/- 20mA // fVal: calibrated float format data // return: refer to error code I8014WAPI void pac_i8014W_ConfigMagicScan(int slot,short chArr[],short gainArr[],short scanChCount,float sampleRate,short scanMode,short triggerSource,short triggerState, float* realSampleRate); // function to configure Magic Scan function, need to be called before start // slot: 0 ~ 7 // chArr[]: {0,1,2,3,4,5,......13,14,15} // gainArr[]: {0,0,0,0,0,0,.....0,0,0,0} // I-8014W / I-9014 0 : +/- 10V 1 : +/- 5V 2 : +/- 2.5V 3 : +/- 1.25V 4 : +/- 20mA // I-8014CW / I-9014C 4 : +/- 20mA // scanChCount: differential : 0~16 // single-ended : 0~8 // sampleRate: 2~050Khz // scanMode: 1 : Standard mode // 2 : Sample amd hole mode // triggerSource: 0 : Software trig // 1 : Internal hardware trig // 2 : External hardware trig // triggerState: Only valid in External hardware trig // 0 : Rising edge // 1 : Falling edge // *realSampleRate: the real sample rate // return: None I8014WAPI short pac_i8014W_StartMagicScan(int slot); // function to start Magic scan, after this function has been called, all the AI data will be save to FIFO // slot: 0 ~ 7 // return: refer to error code I8014WAPI short pac_i8014W_StopMagicScan(int slot); // function to stop Magic scan // slot: 0 ~ 7 // return: refer to error code I8014WAPI short pac_i8014W_ReadFIFO(int slot, short hexData[], short readCount,short* dataCountFromFIFO); // function to read data from FIFO in nonblock mode // slot: 0 ~ 7 // hexData[]: data array // readCount: amount of data required // *dataCountFromFIFO: reading counts of data in this process // return: refer to error code I8014WAPI short pac_i8014W_ReadFIFO_BlockMode(int slot, short dataBuf[], long readCount ,long* dataCountFromFIFO); // function to read data from FIFO in block mode // slot: 0 ~ 7 // dataBuf[]: data array // readCount: amount of data required // *dataCountFromFIFO: reading counts of data in this process // return: refer to error code I8014WAPI void pac_i8014W_UnLockFIFO(int slot); // function to unlock FIFO when FIFO latched // slot: 0 ~ 7 // return: None I8014WAPI void pac_i8014W_ClearFIFO(int slot); // function to clear FIFO // slot: 0 ~ 7 // return: None // APIs for Magic Scan with ISR #ifdef WIN32 I8014WAPI short pac_i8014W_InstallMagicScanISR(int slot,void(__stdcall *isr)(int slot),short triggerLevel); // function to install ISR function for XP-9000/XP-8000 based on WES system // slot: 0 ~ 7 // void(__stdcall *isr)(int slot): function pointer for ISR // triggerLevel: 0 : 8 1 : 16 // 2 : 32 3 : 64 // 4 : 128 5 : 256 // 6 : 512 7 : 2048 // return: refer to error code #else I8014WAPI short pac_i8014W_InstallMagicScanISR(int slot,void(*isr)(int slot),short triggerLevel); // function to install ISR function // slot: 0 ~ 7 // void(*isr)(int slot): function pointer for ISR // triggerLevel: 0 : 8 1 : 16 // 2 : 32 3 : 64 // 4 : 128 5 : 256 // 6 : 512 7 : 2048 // return: refer to error code #endif I8014WAPI short pac_i8014W_UnInstallMagicScanISR(int slot); // function to uninstall ISR function // slot: 0 ~ 7 // return: refer to error code I8014WAPI short pac_i8014W_ReadFIFO_InISR(int slot, short hexData[], short triggerLevel,short* dataCountFromFIFO); // function to read data from FIFO while using ISR function // slot: 0 ~ 7 // hexData[]: data array // triggerLevel: amount of data required // 0 : 8 1 : 16 // 2 : 32 3 : 64 // 4 : 128 5 : 256 // 6 : 512 7 : 2048 // *dataCountFromFIFO: reading counts of data in this process // return: refer to error code I8014WAPI void pac_i8014W_ClearInt(int slot); // function to clear the signal of interrupt, should be called in ISR function // slot: 0 ~ 7 // return: None #ifdef __cplusplus } #endif