Similarly, the group 1 ports can be enabled/disabled via the control register at base a7. The following
program fragment in C language illustrates the foregoing:
const BASE_ADDRESS 0x300;
/*Set the mode to Mode 0, ports A and B as output, and port C as input. Since bit
D7 is high, the output buffers are set to tristate condition. See item b.
above.*/
outportb(BASE_A3, 0x89);
outportb(BASE_ADDRESS,0);
/*These instructions set the initial state of ports A and B to all zeroes. Port C is
not set because it is configured as an input. See item c. above.*/
outportb(BASE_1,0);
/*Enable the tristate output buffers by using the same control byte used to
configure the PPI, but now set bit D7 low. See item d. above.*/
outportb(BASE_A3, 0x09);
PROGRAMMING EXAMPLE (BASIC)
The following example in BASIC is provided as a guide to assist you in developing your working software. In
this example, the card base address is 2D0 hex and the I/O lines of group 0 are to be setup as follows:
Port A
=
Input
Port
B
=
Output
Port C Hi
=
Input
Port C Lo =
Output
The first step is to configure the control register. Configure bits of the control register as:
D7
1
Active Mode Set
D6
0
Mode 0
D5
0
Mode 0
D4
1
Port A = Input
D3
1
Port C Hi = Input
D2
0
Mode 0
D1
0
Port B = Output
D0
0
Port C Lo = Output
Table 6-3: Control Register Configuration
This corresponds to 98 hex. If the card address is 2D0 hex, use the BASIC OUT command to write to the
control register as follows:
10BASEADDR=&H2D0
20OUT B3,&H98
To read the inputs at Port A and the upper nybble of Port C:
30X=INP(BASEADDR)'Read Port A
40Y=INP(B2)/16'Read Port C Hi
To set outputs high (1) at Port B and the lower nybble of Port C:
50OUT B1,&HFF'Turn on all Port B bits
60OUT B2,&HF'Turn on all bits of Port C lower nybble
Manual PCI-DIO-48 H/HS
16
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com