![background image](http://html1.mh-extra.com/html/icp-das-usa/pci-p8r8/pci-p8r8_user-manual_3730821032.webp)
Please refer to the following program code to get these six base addresses for
PCI-P16R16 and PCI-P8R8. These codes are based on PCI
Plug & Play
mechanism 2.
/******************************************************/
/* Reading PCI card's configuration address space */
/******************************************************/
WORD GetAddress(void)
{
DWORD dConfigAddress,dBaseAddress;
WORD HiWord,LoWord;
WORD ReturnCode;
UCHAR Bus,Device,Function,WhichLong;
WORD VendorID,DeviceID;
WORD wIrqNumber;
wTotalBoards=0;
/* initial board number is 0 */
Bus=0;
for(Bus=0; Bus<10; Bus++)
{
Function=0;
WhichLong=1;
for(Device=0; Device<32; +)
{
WhichLong=0;
WriteAddress(Bus,Device,Function,WhichLong);
VendorID=inport(0xcfc);
DeviceID=inport(0xcfe);
if( VendorID==0x1234 && DeviceID==0x1616 )
{
/*----------- PCI-P16R16 --------------*
WhichLong=4;
// Base Address 0
WriteAddress(Bus,Device,Function,WhichLong);
dBaseAddress=_inpd(0xcfc);
wBaseAddr0=(WORD)(dBaseAddress&0xfffe);
wConfigSpace[wTotalBoards][0]=wBaseAddr0;
PCI-P16R16 Series User Manual (Ver.2.8, Apr. 2011, PMH-013-28)
30