/**********************************************************************/ /* This program is developed by Turbo C 2.0 */ /***********************************************************************/ /* Demo 30: One PCI-1202 Card P1202_AdsPacer Function demo. */ /* First Card: To acquire A/D CH:2, CH:3, CH:4 250 times. */ /* The sampling rate is 8M/wFreqDiv */ /***********************************************************************/ #define MYLIB #include "P1202.H" #define DATACOUNT 250 WORD wDaNum=90,wAdClk=80; float fV2[DATACOUNT]; /* AD ch:2 buffer */ float fV3[DATACOUNT]; /* AD ch:3 buffer */ float fV4[DATACOUNT]; /* AD ch:4 buffer */ WORD wPlot2[500]; /* transformed into wave form */ WORD wPlot3[500]; /* transformed into wave form */ WORD wPlot4[500]; /* transformed into wave form */ WORD old_wPlot2[500]; /* transformed into wave form */ WORD old_wPlot3[500]; /* transformed into wave form */ WORD old_wPlot4[500]; /* transformed into wave form */ int main() { WORD i,j; WORD wBoards,wRetVal,wFreqDiv,wConfig; WORD wDIOdata; float fVal; char ch,cShow[80]; WORD wAddrTimer,wAddrCtrl,wAddrDio,wAddrAdda; clrscr(); /* initiaing P1202 card and detect how many P1202 card in PC */ wRetVal=P1202_DriverInit(&wBoards); printf("Threr are %d P1202 Cards in this PC\n",wBoards); if( wBoards==0 ) { putch(0x07); putch(0x07); putch(0x07); printf("There are no P1202 card in this PC !!!\n"); exit(0); } /* dump every P1202 card's configuration address space */ printf("The Configuration Space -> Timer Control DIO AD/DA\n"); for(i=0; i Config:0-B(hex)\n"); printf(" PCI-1202H(High Gain) -> Config:10-1B(hex)\n"); printf("Enter Config(hex):"); scanf("%x",&wConfig); printf("\nPlease Enter the Freq Divisior(8000): "); scanf("%d",&wFreqDiv); /* The P1202_ActiveBoard() function must be used to active a board, */ /* then all operation will take effect to the actived board. */ printf("Now Active First P1202 Card...\n"); P1202_ActiveBoard( 0 ); graphic_init(); cleardevice(); sprintf(cShow,"Pacer Trigger Sampling Rate:%.2f KHz", 8000.0/wFreqDiv); setcolor(RED); outtextxy(120,10,cShow); for (i=0; i