// i8017HW_ReadAI.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include "pac_i8017HW.h" #pragma comment(lib,"pac_i8017HW.lib") static int slotIndex=-1; int main(int argc, char* argv[]) { //Declaration and default value assignment char GainStr[5][32]={"+/-10V","+/-5V","+/-2.5V","+/-1.25V","+/-20mA"}; char ModeStr[2][32]={"Standard Mode", "Sample and Hold Mode"}; int slot = -1; int channel = 0; int maxCh = 8; short jumper=0; int gain = 0; float fValue = 0; int return_value = 0; short ret; unsigned short gVal=0; short oVal=0; for(slot=0;slot<8;slot++) { ret=pac_i8017HW_Init(slot); if(ret==0) { slotIndex=slot; break; } //else //printf("ret= %d in slot %d\n",ret,slot); } if(slotIndex==-1) { printf("There is no i8017HW at Backplane\n"); getchar(); return-1; } else { printf("There is an i8017HW at slot %d\n",slotIndex); } pac_i8017HW_GetSingleEndJumper(slotIndex, &jumper); if(jumper) { maxCh=16; printf("\t i8017HW Input Mode=Single-End and can have maximum 16 analog input\n\r"); } else { maxCh=8; printf("\t i8017HW Input Mode=Differential and can have maximum 8 analog input\n\r"); } printf("\nCalibration parameter:"); for(gain=0;gain<=4;gain++) { pac_i8017HW_ReadGainOffset_Info(1,gain,&gVal,&oVal); printf("\nType code %d: %s , Gain=%u; Offset=%d",gain,GainStr[gain],gVal,oVal); } printf("\nSelect Type code for i8017HW"); for(int i=0;i<=4;i++) { printf ("\n\t Select %d : %s",i,GainStr[i]); } printf("\n\r"); scanf("%d", &gain); for(channel=0;channel