Appendix B
Register-Level Programming — Programming
©
National Instruments Corporation
B-19
PCI-DIO-96/PXI-6508/PCI-6503 User Manual
Mode 0 Basic I/O Programming Example
The following example shows how to configure PPI A for mode 0 input and output.
Write (8255Cnfg,0x80)
Set mode 0—ports A, B, and C are outputs
Write (PortA, Data)
Write data to port A
Write (PortB, Data)
Write data to port B
Write (PortC, Data)
Write data to port C
Write (8255Cnfg,0x90)
Set mode 0—port A is Input;ports B and
C are outputs
Write (PortB, Data)
Write data to port B
Read (PortA)
Read data from port A
Mode 1—Strobed Input
Note
For mode 1 examples, you must configure the don’t care bits appropriately in the
control word if you want to use the other ports in combination with the example.
In mode 1, the digital I/O bits are divided into two groups: group A and group B. Each of
these groups contains one 8-bit port and one 3-bit control/data port. The 8-bit port can be
either an input or an output port, and the 3-bit port is used for control and status information
for the 8-bit port. Handshaking signals in the 3-bit port synchronize the transfer of data.
Figure B-4 shows the control word written to the Configuration Register to configure port A
for input in mode 1. You can use bits PC6 and PC7 of port C as extra input or output lines.
Figure B-4.
Control Word to Configure Port A for Mode 1 Input
Port C bits PC6 and PC7
1 = Input
0 = Output
D7
D6
D5
D4
D3
D2
D1
D0
1
0
1
1
1/0
X
X
X