Set I/O Port Polarity

NI-Motion VI

Set I/O Port Polarity

Sets the bit polarity in a general-purpose 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
IO Polarity is the bitmap of active polarities for the I/O port:
If IO Polarity Bit 0 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
If IO Polarity Bit 1 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
If IO Polarity Bit 2 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
If IO Polarity Bit 3 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
If IO Polarity Bit 4 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
If IO Polarity Bit 5 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
If IO Polarity Bit 6 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
If IO Polarity Bit 7 is TRUE (default) the bit is set to active low/active open. If it is FALSE the bit is set to active high/active closed.
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 control.
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.
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 Set I/O Port Polarity VI sets the polarity (active state) of the general-purpose I/O port on an individual bit basis.

When configured as active low, the input or output is active when there is a low signal on the pin. Conversely, active high means that the input or output is active when there is a high signal on the pin.

Configuring an active state of active open or active closed does not correspond to the level of the signal on the input or output pin. Instead, an active open state means that the input or output is active when current is not flowing through the optocoupled input. Conversely, an active closed state means that the input or output is active when current is flowing through the optocoupled input.

Typically, ports and their pins are configured for direction and polarity (active state) at initialization. After configuration, you can then read or write logical states (True or False, On or Off) to ports without worrying about the physical states of signals on the port pins.

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 list includes considerations you must make when you are using this VI with a 73xx motion controller:

  • The polarity also defines the latching behavior for the RTSI port. In order to detect short pulses on RTSI lines, the hardware latches active-going signals and holds that state until the port is read. For example, if you configure a bit for active low polarity, a transition from high to low is latched until read, even if the signal goes high again. If the signal starts low, it is also latched until read, even if the signal is high when you read the bit.
  • 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 configure the polarity of the output port on axis 2, Port is 0x82 (130). To configure the polarity of the input port on axis 3, Port is 0x03 (3).

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 configure the polarity of the output port on axis 2, Port is 0x82 (130). To configure the polarity of the input port on axis 3, Port is 0x03 (3).
  • The RTSI port is not supported by the NI SoftMotion Controller.