Mode 0 basic i/o programming example, Mode 1–strobed input, Figure 6-1. control word to configure port a for m – National Instruments 6508 PCI-DIO-96 User Manual

Page 56: Mode 0 basic i/o programming example -10, Mode 1–strobed input -10, Figure 6-1

Advertising
background image

Chapter 6

Programming

PCI-DIO-96 User Manual

6-10

© National Instruments Corporation

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 4-bit
control/data port. The 8-bit port can be either an input or an output port,
and the 4-bit port is used for control and status information for the 8-bit
port. The transfer of data is synchronized by handshaking signals in the
4-bit port.

The control word written to the Configuration Register to configure
port A for input in mode 1 is shown in Figure 6-1. You can use bits PC6
and PC7 of port C as extra input or output lines.

Figure 6-1. 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

Advertising