/* If have any problem in using this demo program, please mail to service@icpdas.com This demo shows some features: 1. This demo will show the "Firmware Version" , "Lib built date" and Gain/Offset for Calibration of i-8017H/i-8017HS/i-8017HW If this demo get wrong AI data for 8017H,8017HS or 8017HW, please send these message to service@icpdas.com 2. For i-8017HS or i-8017HW, it has two input signal mode, Differential(Isolated)/Single Ended(None Isolated). Default is Differential(Isolated). 3. For old 8017HL.lib it must i8017H_Set_ChannelGainMode before use i8017H_Get_AD_FValue and i8017H_Get_AD_HValue, Now it can be done only use i8017H_ReadAI 4. For i-8000 system, it will spend much time to convert hex value to float format,if performance is the issue, it can i8017H_ReadAIHex to get hex data then convert collected data to float. */ #include #include "..\..\..\..\Lib\P821.h" #include "..\..\..\..\Lib\8017H.h" char gainStr[5][32]={"+/-10V","+/-5V","+/-2.5V","+/-1.25V","+/-20mA"}; char DSubStr[2][32]={"Close","Open"}; short jumper; short firmware; void ShowGainInfo(int slot,int gain); int main(void) { int maxCh=8; float fVal=0; char sTemp[20]; int iGain=0; char libDate[32]; short DSubStatus; int i,slot,findIO=0; unsigned long T1,T3; InitLib(); for(i=0;i1000) // read frequency every 300 ms { T1=T3; i8017H_Get_D_Sub_Status(slot,&DSubStatus); Print(" D Sub connector status (For I-8017DW only ) : %s \n\r",DSubStr[DSubStatus]); for(i=0;i 4) { Print("\nGain Value must between 0 ~ 4"); } else { Print("\nSelect Gain[%d]=%s for Slot[%d]",gain,gainStr[gain],slot); i8017H_ReadGainOffset_Info(slot,gain,&gVal,&oVal); Print("\nThe Gain and Offset for Calibration is Gain=%u; Offset=%d",gVal,oVal); } Print("\n===============================================================\n"); }