Chapter 10 Easy I/O for DAQ Library
© National Instruments Corporation 10-51 LabWindows/CVI Standard Libraries
• The portWidth for the 8255-based digital I/O ports (including all digital ports on Lab
boards, SCXI-1200, DAQPad-1200, DAQCard-1200, DIO-24, DIO-32F, DIO-96, and
AT-MIO-16DE-10/AT-MIO-16D ports 2, 3 and 4) should be at least 8.
configure specifies whether to configure the digital port before reading.
• When this function is called in a loop, it can be optimized by only configuring the digital port
on the first iteration.
• When you configure a digital I/O port that is part of an 8255 PPI (including all digital ports
on Lab boards, SCXI-1200, DAQPad-1200, DAQCard-1200, DIO-24, DIO-32F, DIO-96,
and AT-MIO-16DE-10/AT-MIO-16D ports 2, 3 and 4), the 8255 PPI goes through a
configuration phase, where all the ports within the same PPI chip get reset to logic low,
regardless of the data direction. The data directions on other ports, however, are maintained.
ReadFromDigitalPortshort error = ReadFromDigitalPort (short device, char portNumber[],
short portWidth, long configure,
unsigned long *pattern);
Purpose
Reads a digital port that you configure for input.
Parameters
Input device short integer Assigned by configuration utility.
portNumber string Specifies the digital port this function
configures.
line short integer Specifies the individual bit or line within the port
to be used for I/O.
portWidth short integer The total width in bits of the port. For example,
you can combine two 4-bit ports into an 8-bit
port on an MIO (non E-Series) board by setting
portWidth to 8.
configure long integer 1: Configure the digital port before reading;
0: Don’t configure the digital port before
reading. When this function is called in a loop, it
can be optimized by only configuring the digital
port on the first iteration.
Output pattern unsigned
long integer The data read from the digital port.