#include #include #include #include "icpdas_mbs.h" #include "msw.h" void set_di(char b) { unsigned char mask = 0x01; int i; for (i=0; i<8; ++i) { if ((b & mask) != 0) { iMemory_DI[i]=1; } else { iMemory_DI[i]=0; } mask <<= 1; } } int main(int argc,char *argv[]) { int tmp=0; int di=0; int RetValue,slot,channel; SHM_INIT(DI,2000); slot=4; channel=0; RetValue = Open_Slot(slot); if (RetValue >0) { printf("open Slot %d failed!\n",slot); return FAILURE; } while (1) { di=DI_8(slot); if (di != tmp) { set_di(di); tmp=di; } usleep(100); } Close_Slot(slot); return 0; }