// i8093W_ReadCounts.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "pac_i8093W.h" #include #pragma comment(lib,"pac_i8093W.lib") #define CW_CCW 1 #define PULSE_DIRECTION 2 #define QUADRANT 3 static int slotIndex=-1; int main(int argc, char* argv[]) { int slot = 1; int channel = 0; long counts = 0; int return_value = 1; for(slot=0;slot<8;slot++) { if(pac_i8093W_Init(slot)==0) { slotIndex=slot; break; } } if(slotIndex==-1) { printf("There is no i8093W at Backplane\n"); getchar(); return -1; } else { printf("There is an i8093W at slot %d\n",slotIndex); } for(channel=0;channel<3;channel++) { pac_i8093W_SetMode(slotIndex, channel, CW_CCW); return_value = pac_i8093W_Read32BitEncoder(slotIndex, channel, &counts); if(OK == return_value) { printf("In the slot: %d, and in the channel: %d\n", slotIndex, channel); printf("the counts= %d (in the CW/CCW Mode)\n", counts); } else { printf("ERROR! reading counts error in the channel %d, and slot %d\n", slotIndex, channel); } } getchar(); return 0; }