![ICP DAS USA PCI-1202 Series Скачать руководство пользователя страница 85](http://html2.mh-extra.com/html/icp-das-usa/pci-1202-series/pci-1202-series_user-manual_4476309085.webp)
PCI-1202/1602/180x Series Card
Multi-Function Boards
User Manual/ Ver. 4.8/ Mar. 2015/ PMH-0014-48/ Page: 85
The sample code of software trigger A/D conversion is given as follows:
P180x_AdPollingHex (…) is designed for PCI-1800/1802 series
P1202_AdPollingHex (…) is designed for PEX-1202/PCI-1202 series
P1602_AdPollingHex (…) is designed for PCI-1600 series
WORD
P180X_AdPollingHex
(Word *AdVal)
{
WORD wVal, wTime ;
//Clear FIFO
outport(wAddrCtrl,0x2000);
// B15=0=clear FIFO, B13=1=not MagicScan controller cmd
outport(wAddrCtrl,0xA000);
// B15=1=no clear FIFO, B13=1= not MagicScan controller cmd
outport((WORD)(wA4),0xffff);
/* generate a software trigger pulse */
wTime=0;
for (;;)
{
wVal=inport(wAddrCtrl)&0x20;
// wait for ready signal
if (wVal!=0) break;
/* if B4==1
A/D data ready */
wTime++;
if (wTime>32760) return(AdPollingTimeOut);
}
AdVal=inport(wAddrAdda)&0x0fff;
/
*
Read the available A/D data from FIFO */
return(NoError);
/* 0x0fff for 12-bit ADC, 0xffff for 16-bit ADC */
}