// i8084W_ReadCntUp.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include "pac_i8084W.h" #pragma comment(lib,"pac_i8084W.lib") static int slotIndex=-1; int _tmain(int argc, _TCHAR* argv[]) { //Declaration and default value assignment int slot = 1; int channel = 0; const int UP_COUNTER_MODE = 3; unsigned long count = 0; unsigned int overflow = 0; int return_value = 0; printf("8084W pac_i8084W_ReadCntUp Demo \n"); for(slot=0;slot<8;slot++) { if(pac_i8084W_InitDriver(slot)==0) { slotIndex=slot; break; } } if(slotIndex==-1) { printf("There is no i8084W at Backplane\n"); getchar(); exit(0); } else { printf("There is an i8084W at slot %d\n",slotIndex); } for (channel=0;channel<8;channel++) { pac_i8084W_SetChannelMode(slotIndex, channel, UP_COUNTER_MODE); } Sleep(3000); //hold for counts coming in for (channel=0;channel<8;channel++) { return_value = pac_i8084W_ReadCntUp(slotIndex, channel, &count, &overflow); if(OK == return_value) { printf("\n\n"); printf("In the slot: %d, and in the channel: %d\n", slotIndex, channel); printf("the counts= %u (in the Up Counter Mode)\n", count); if(overflow == 1) printf("There's been an overflow occurred!\n"); else printf("There's been no overflow occurred.\n"); } else { printf("ERROR! reading counts error in the channel %d, and slot %d\n", slotIndex, channel); } } getchar(); return 0; }