// i8172W_FR_2054DIO.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,iRet=0; int diData,group,i,channel,mode,status,port,doData,bitVal; 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("Please input the port number of i-8172W 0 or 1:"); scanf("%d",&port); printf("Please input the group index of FR-2057 0~7 :"); scanf("%d",&group); printf("\nPlease input operation mode:\n"); printf("0. Write single channel output \n"); printf("1. Write multi channel output \n"); printf("2. Read single channel input \n"); printf("3. Read all channel input :"); scanf("%d",&mode); switch(mode) { case 0: printf("\nPlease input channel number(0~7)\n"); scanf("%d",&bitVal); printf("Please input status(0.OFF, 1.ON )\n"); scanf("%d",&status); pac_i8172W_WriteDOBit(slotIndex,port,group,bitVal,status); break; case 1: printf("\nEnter DO Data 0 ~ 0xff :r"); scanf("%X",&doData); pac_i8172W_WriteDOGroup(slotIndex,port,group,doData & 0xff); break; } getchar(); return 0; }