Read I/O Port

NI-Motion VI

Read I/O Port

Reads the logical state of the bits in an I/O port.

Details     Remarks

Device Compatibility

DeviceCompatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Accelnet
Y
NI SoftMotion Controller for CANopen—Xenus
Y
Board ID is a unique number assigned by Measurement & Automation Explorer (MAX) used to send and receive commands and data to or from a specific NI motion controller.
Port (1) is the general-purpose I/O port (1–8) or RTSI software port (9) to read.
Retn Vect indicates the destination for the return data generated by this VI. Available return vectors include return data to the host (0xFF), to a variable (0x01 through 0x78), to an indirect variable (0x81 through 0xF8), and do not return data (0). Refer to Input and Return Vectors for more detailed information.
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.
Port Data is the bitmap of the logical state of the I/O port:
If Port Data Bit 0 is TRUE the I/O bit is on. If it is FALSE the bit is off.
If Port Data Bit 1 is TRUE the I/O bit is on. If it is FALSE the bit is off.
If Port Data Bit 2 is TRUE the I/O bit is on. If it is FALSE the bit is off.
If Port Data Bit 3 is TRUE the I/O bit is on. If it is FALSE the bit is off.
If Port Data Bit 4 is TRUE the I/O bit is on. If it is FALSE the bit is off.
If Port Data Bit 5 is TRUE the I/O bit is on. If it is FALSE the bit is off.
If Port Data Bit 6 is TRUE the I/O bit is on. If it is FALSE the bit is off.
If Port Data Bit 7 is TRUE the I/O bit is on. If it is FALSE the bit is off.
Bd ID Out is provided for flow control. You can string together NI-Motion VIs by wiring the Bd ID Out terminal of one VI to the Board ID terminal of the next VI.
Resource Out is the Axis, Vector Space, ADC, or Encoder you wired into the VI. Use Resource Output to pass the resource to another VI and/or to display information about the device.
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

The Read I/O Port VI reads the logical state of the bits in the general-purpose I/O port selected. You can execute this VI at any time to monitor the signals connected to an input port. Reads of ports configured as outputs return the last value written to the port with the Set I/O Port MOMO VI.

Note  This VI reads the logical state (On or Off, True or False) of the bits in a port. The polarity of the bits in the port determines whether an On state is active high or active low. Refer to the Set I/O Port Polarity VI for more information.
Note  Refer to VI Execution Times for benchmark timing information about your controller.

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 has dedicated direction I/O ports. Refer to 73xx Controller General-Purpose I/O Port IDs for the appropriate port number to use for Port.

    For example, to read the state of input port 3, Port is 0x03 (3). To read the value previously set on output port 2, Port is 0x82 (130)
  • When reading the RTSI port, the value read is the latched data, so you can detect active pulses on the RTSI bus. After reading the latched data value, the VI resets the latch. Use the Set I/O Port Polarity VI to specify the polarity—and therefore the active state—for latching.

NI SoftMotion Controller Considerations

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

  • The NI SoftMotion Controller has dedicated direction I/O ports. Refer to NI SoftMotion Controller General-Purpose I/O Port IDs for the appropriate port number to use for Port.

    For example, to read the state of output port 2, Port is 0x82 (130). To read the state of input port 3, Port is 0x03 (3).
  • The RTSI port is not supported by the NI SoftMotion Controller.