/*****************************************************************************/ /* This program is developed by MicroSoft C 5.1 */ /******************************************************************************/ /* Demo 15: One P180X Card demo. */ /* For identify Card Number easily, Using the digital output and digital */ /* input function. */ /******************************************************************************/ #define MYLIB #include "P180X.H" int main() { int i,j; WORD wBoards,wRetVal; WORD wDIOdata,wOutput; DWORD dwCount=0; float fVal; WORD wAddrTimer,wAddrCtrl,wAddrDio,wAddrAdda; clrscr(); // a clear screen function in P180XMC?.LIB gotoxy(1,1); // initiaing P180X card and detect how many P180X card in PC wRetVal=P180X_DriverInit(&wBoards); printf("Threr are %d P180X Cards in this PC\n",wBoards); if( wBoards==0 ) { putch(0x07); putch(0x07); putch(0x07); printf("There are no P180X card in this PC !!!\n"); exit(0); } /* dump every P180X card's configuration address space */ printf("The Configuration Space -> Timer Control DIO AD/DA\n"); for(i=0; i %04xH | Digital Input -> %04xH\n", i,wOutput,wDIOdata); } else printf(" %dth Card: Digital Output -> %04xH | Digital Input -> %04xH\n", i,wOutput,wDIOdata); } dwCount++; if( wOutput==0x5555 ) wOutput=0xaaaa; else wOutput=0x5555; for(j=0; j<1000; j++) P180X_DelayUs(1000); // delay 300 ms just for display purpose if( kbhit() ) break; } return 0; }