PCI-1002 Series Card
12-bit, 110 kS/s or 44 kS/s Multi-function Board
User Manual, Ver. 3.0, Jun. 2018, PMH-015-30, Page: 61
clrscr();
P1002_DriverInit(&wBoards);
printf("\
n(1) Threr are %d PCI
-1002 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no PCI-1002 card in this PC !!!\n"); exit(0);
}
printf("\n(2) Show the Configuration Space of all PCI-1002:");
for(i=0; i<wBoards; i++)
{
P1002_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\
n Card_%d: wBaseAddr=%x, wIrq=%x, wPLX=%x",i,wBaseAddr,
wIrq,wPLX);
}
P1002_GetConfigAddressSpace(0,&wBaseAddr,&wIrq,&wPLX);
/* select card_0 */
printf("\
n(3) *** Card_0, wBaseAddr=%x ***
\n",wBaseAddr);
SetupTimer(0,1);
// AdPolling have to disable timer 0
AdPolling(0,0,23);
// channel=0, gain=+/-10, delay=23us
for(i=0;i<10;i++)
{
outp(wB0x1c,01);
// AD software trigger
while(1)
{
if( ((inpw(wB0x10))&0x01)==1) // check if AD ready?
break;
}
wAdData=((inpw(wB0x30))&0x0fff);
printf("\nRang:+/-
10V, Counter %d ,ADC channel 0 value: 0x%xH",i,wAdData);
}
P1002_DriverClose();
}