Write Digital I/O Data

NI-Motion VI

Write Digital I/O Data

Sets 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
data in is a cluster of variables that contains the values for the selected attribute.
integer is 32-bit integer data.
double is 64-bit floating point data.
Boolean is Boolean data.

Based on the attribute, the correct member of data in must be set as follows:

  • For output active state, set the Boolean element of the data in cluster to TRUE to set the active state to active low/active open, and set it to FALSE to set the active state to active high/active closed.
  • For input active state, set the Boolean element of the data in cluster to TRUE to set the active state to active low/active open, and set it to FALSE to set the active state to active high/active closed.
  • For output active, set the Boolean element of the data in cluster to TRUE to configure the output line as active, and set it to FALSE to configure the output line as inactive.
  • For configure as input, set the Boolean element of the data in cluster to TRUE to configure the line for input, and set it to FALSE to configure the line for output.
attribute is the attribute you want to load. The following are valid attributes:
  • output active state—Sets the active state of the specified output line.
  • input active state—Sets the active state of the specified input line.
  • output active—Sets the current output state of the specified line.
    Note  Setting this attribute on a line configured for input returns an error.
  • configure as input—Sets the direction of the specified line.
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.
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.
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 set the attribute on a single digital I/O line. The digital I/O lines are divided among the axes.

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 write to (input or output) is determined by the value specified in line in and attribute.

    For example, to change the input active state of line 1 on axis 2, call Write Digital I/O Data with the following parameters:

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

    The active state is applied to axis 2 General-Purpose Input Bit 1.

    To change the output active state of line 1 on axis 2, call Write Digital I/O Data with the following parameters:

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

    The active state is applied to axis 2 General-Purpose Output Bit 1.

  • 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 Write Digital I/O Data on a four axis controller with eight digital I/O ports with

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

    applies the polarity to 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.