// i8172W_FR_2053DI.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include "pac_i8172W.h" #pragma comment(lib,"pac_i8172W.lib") static int slotIndex=-1; int main(int argc, char* argv[]) { int slot = -1; int diData,group,i,channel,mode,status,port; for(slot=0;slot<8;slot++) { if(pac_i8172W_Init(slot)==0) { slotIndex=slot; break; } } if(slotIndex==-1) { printf("There is no i8172W at Backplane\n"); getchar(); return -1; } else { printf("There is an i8172W at slot %d\n",slotIndex); } printf("\nPlease input the port number of i-8172W 0 or 1:"); scanf("%d",&port); printf("\nPlease input the group index of FR-2053 8~15 :"); scanf("%d",&group); printf("\nPlease select read mode:\n"); printf("0. Read single channel\n\r"); printf("1. Read all channel\n\r"); printf("\nInput read mode:"); scanf("%d",&mode); if(mode) { diData=pac_i8172W_ReadDIGroup(slotIndex,port,group); printf("DIdata %X\n\r",diData); } else { for(channel=0;channel<16;channel++) printf("CH[%d]= %d \n\r", channel,pac_i8172W_ReadDIBit(slotIndex,port,group,channel)); } getchar(); return 0; }