ICP DAS USA PCI-P16POR16 Manual Do Utilizador

Página de 48
 
4 .    I/O Control Register 
 
        The First 16 double words of a PCI device's configuration space is referred 
to as the device's configuration region. Within these the 16 (0-15) double words, 
the 04, 05, 06, 07, 08 and 09 double words are referred to as Base Address0, 
Base Address1, Base Address2, Base Address3, Base Address4 and Base 
Address5. For more detailed information for about these 16 double words, 
please referring the book titled PLUG AND PLAY SYSTEM 
ARCHITECTURE
(written by Tom Shanley, Addison-Wesley Publish Company, 
1995). These base addresses are utilized as control register and/or I/O register 
for many data acquisition boards. On PCI-P16R16 and PCI-P8R8 boards, the 
base address2 is utilized as the base address of digital in and digital out. So the 
Digital I/O functions for PCI-P16R16 and PCI-P8R8 are coded as follows: 
 
#define WORD    unsigned int 
#define UCHAR  unsigned char 
void   P16R16_DO(WORD BaseAddr, WORD wOutData) 

      outport(BaseAddr,wOutData); 

WORD   P16R16_DI(WORD BaseAddr) 

 WORD 
DigitalIn; 
    DigitalIn=inport(BaseAddr); 
    return DigitalIn; 

void   P8R8_DO(WORD BaseAddr, WORD wOutData) 

      outportb(BaseAddr,wOutData); 

UCHAR  P8R8_DI(WORD BaseAddr) 

    UCHAR DigitalIn; 
    DigitalIn=inportb(BaseAddr); 
    return DigitalIn; 

 
PCI-P8R8/P16R16/P16C16/P16POR16 User’s Manual  (Ver.2.2, 2005/5/5) …
29