Note
Note that all data bits except D7 must be the same for the two control bytes
Those buffers will now remain enabled until another control byte with data bit D7 high is sent to base
a3.
Similarly, the Port 1 groups 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;
outportb(BASE_A3, 0x89); /*This instruction sets 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_ADDRESS,0);
outportb(BASE_1,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_A3, 0x09); /*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.*/
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
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:
10
BASEADDR=&H2D0
20
OUT
B3,&H98
To read the inputs at Port A and the upper nybble of Port C:
30
X=INP(BASEADDR)
'Read Port A
40
Y=INP(B2)/16
'Read Port C Hi
Manual PCI-DIO-48(S)
19