Read Digital I/O Data

NI-Motion VI

Read Digital I/O Data

Reads the attribute on a single digital I/O line.

Details     Remarks

Device Compatibility

DeviceCompatibility
7330
Y
7340
Y
7344
N
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Accelnet
Y
NI SoftMotion Controller for CANopen—Xenus
Y
attribute is the attribute you want to read. The following are valid attributes:
  • output active state—Returns the active state of the specified output line to the Boolean element of the data cluster. TRUE indicates active low/active open. FALSE indicates active high/active closed.
  • input active state—Returns the active state of the specified input line to the Boolean element of the data cluster. TRUE indicates active low/active open. FALSE indicates active high/active closed.
  • output active—Returns the current output state of the specified line to the Boolean element of the data cluster. TRUE indicates the output line is active. FALSE indicates the output line is inactive.
    Note  Reading this attribute on a line configured for input returns error -70102 (NIMC_wrongIODirectionError).
  • input active—Returns the input state of the specified line to the Boolean element of the data cluster. TRUE indicates the input line is active. FALSE indicates the input line is inactive.
    Note  Reading this attribute on a line configured for output returns error -70102 (NIMC_wrongIODirectionError).
  • configure as input—Returns the direction of the specified line to the Boolean element of the data cluster. TRUE indicates input, FALSE indicates output.
board in is a unique number assigned by Measurement & Automation Explorer used to send and receive commands and data to or from a specific NI motion controller.
axis in is the axis you are controlling.
line in is the digital line of the axis to read. Valid range is 1 to 32.
error in (no error) describes error conditions that occur before this VI runs. The default input of this cluster is no error. If an error already occurred, this VI returns the value of error in in error out. The VI runs normally only if no incoming error exists. Otherwise, the VI passes the error in value to error out. The error in cluster contains the following parameters:
status is TRUE if an error occurred before this VI was called, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
data out is a cluster of variables that contains the values for the selected attribute. Based on the attribute, the correct member of data out will be set by the motion controller.
integer is 32-bit integer data.
double is 64-bit floating point data.
Boolean is Boolean data.
board out is provided for flow control. You can string together NI-Motion VIs by wiring the board out terminal of one VI to the board in terminal of the next VI.
axis out is provided for flow control. You can string together NI-Motion VIs by wiring the axis out terminal of one VI to the axis in terminal of the next VI.
line out is provided for flow control. You can string together NI-Motion VIs by wiring the line out terminal of one VI to the line in terminal of the next VI.
error out contains error information. If error in indicates an error, error out contains the same error information. Otherwise, it describes the error status that this VI produces.
status is TRUE if an error occurred, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.

Using This VI

Use this VI to read the attribute on a single digital I/O line. The digital I/O lines are divided among the axes.

Caution  If this VI uses reflective memory, it should not be used for event checking. In this case, only use the information returned by this VI for display purposes. Refer to Reflective Memory VIs for more information.

Remarks

This section includes information about how the behavior of this VI differs among the controllers that support it.

NI 73xx Controller Considerations

The following includes considerations you must make when you are using this VI with a 73xx controller:

  • The PCI-7390 does not support the configure as input attribute.
  • The PCI-7390 has dedicated direction I/O lines. On these controllers, the pin you read (input or output) is determined by the value specified in line in and attribute.

    For example, to read the input active state attribute of General-Purpose Input Bit 1 on axis 2, call the Read Digital I/O Data VI with the following parameters:

    axis in = 2
    line in = 1
    attribute = input active state

    To read the output active state of General-Purpose Output Bit 1 on axis 2, call the Read Digital I/O Data VI with the following parameters:

    axis in = 2
    line in = 1
    attribute = output active state

  • 7330, 7340, and 7350 controllers have configurable direction I/O lines. On these controllers, the line number is translated to port and line number. For example, a call to Read Digital I/O Data on a four axis controller with eight digital I/O ports and

    axis in = 2
    line in = 15
    attribute = input active state

    reads the active state of port 6 bit 7.

  • The following table lists the port to axis and line mapping for 7350 controllers:
    Number of Axes Axis Number Line 0 to 7 Line 8 to 15 Line 16 to 23 Line 24 to 31
    2 1 Port 1 Port 3 Port 5 Port 7
    2 Port 2 Port 4 Port 6 Port 8
    4 1 Port 1 Port 5
    2 Port 2 Port 6
    3 Port 3 Port 7
    4 Port 4 Port 8
    6 1 Port 1
    2 Port 2
    3 Port 3
    4 Port 4
    5 Port 5 Port 7
    6 Port 6 Port 8
    8 1 Port 1
    2 Port 2
    3 Port 3
    4 Port 4
    5 Port 5
    6 Port 6
    7 Port 7
    8 Port 8
  • The following table lists the port to axis and line mapping for 7330 and 7340 controllers:
    Number of Axes Axis Number Line 0 to 7 Line 8 to 15
    2 1 Port 1 Port 3
    2 Port 2 Port 4
    4 1 Port 1
    2 Port 2
    3 Port 3
    4 Port 4

NI SoftMotion Controller Considerations

The following includes considerations you must make when you are using this VI with the NI SoftMotion Controller:

The NI SoftMotion Controller does not support the configure as input attribute.