/**********************************************************************/ /* This program is developed by Borland C++ 3.1 */ /***********************************************************************/ /* Demo 12: Two P180X Cards MagicScan Function demo. */ /* First Card: To acquire A/D CH:0, CH:1 250 times. */ /* Second Card: To acquire A/D CH:0, CH:1 250 times. */ /***********************************************************************/ #define MYLIB #include "P180X.H" #define DATACOUNT 250 WORD wDaNum=90,wAdClk=24; WORD wV0[DATACOUNT]; /* AD ch:0 buffer */ WORD wV1[DATACOUNT]; /* AD ch:1 buffer */ WORD wPlot0[DATACOUNT]; /* transformed into wave form */ int main() { WORD i,j; WORD wBoards,wRetVal; WORD wDIOdata; float fVal; char cShow[80]; WORD wAddrTimer,wAddrCtrl,wAddrDio,wAddrAdda; DWORD dwHiAlarm,dwLoAlarm; clrscr(); /* 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<=1 ) { putch(0x07); putch(0x07); putch(0x07); printf("Please install two P180X cards 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 1234H | Digital Input -> %04xH\n",wDIOdata); printf("--------------------------------------------------\n"); printf("Now Active Second P180X Card...\n"); P180X_ActiveBoard( 1 ); P180X_Do(0x5678); /* Digital output */ P180X_Di(&wDIOdata); /* Digital input */ printf("Digital Output -> 5678H | Digital Input -> %04xH\n",wDIOdata); printf("\nHit any key to show wave form.\n"); getch(); /***************************************************************/ graphic_init(); cleardevice(); setcolor(RED); /* To active the first card */ P180X_ActiveBoard( 0 ); for (i=0; i