nimcWriteMotionIOData |
Write Motion I/O Data
Usage
status = nimcWriteMotionIOData(TnimcDeviceHandle deviceHandle, TnimcAxisHandle axisHandle, TnimcMotionIOData attribute, TnimcData* data);
Purpose
Loads configuration parameters for the motion inputs and outputs.
Tip Refer to the Remarks section for information about how the behavior of this function differs between controllers. |
Parameters
Name | Type | Description |
---|---|---|
deviceHandle | TnimcDeviceHandle | assigned by Measurement & Automation Explorer (MAX) |
axisHandle | TnimcAxisHandle | axis to configure |
attribute | TnimcMotionIOData | attribute to set |
data | TnimcData* | the value for the attribute you are loading |
Parameter Discussion
axisHandle is the axis to configure with this function. Valid values are 1 through 30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error 70006 (NIMC_badResourceIDOrAxisError).
attribute is the attribute to load. The following are valid attributes:
- TnimcMotionIODataForwardLimitEnable
- TnimcMotionIODataReverseLimitEnable
- TnimcMotionIODataForwardSoftwareLimitEnable
- TnimcMotionIODataReverseSoftwareLimitEnable
- TnimcMotionIODataHomeInputEnable
- TnimcMotionIODataForwardLimitActiveState
- TnimcMotionIODataReverseLimitActiveState
- TnimcMotionIODataHomeInputActiveState
- TnimcMotionIODataForwardSoftwareLimitPosition
- TnimcMotionIODataReverseSoftwareLimitPosition
- TnimcMotionIODataInhibitInEnable
- TnimcMotionIODataInhibitInActiveState
- TnimcMotionIODataInPositionActiveState
- TnimcMotionIODataPulseAlarmClear
- TnimcMotionIODataAlarmClearPulseWidth
- TnimcMotionIODataDriveReadyEnable
- TnimcMotionIODataInhibitOutEnable
- TnimcMotionIODataInhibitOutTotemPole
- TnimcMotionIODataInhibitOutActiveState
data is the value for the attribute you are loading in the following structure:
struct{
i32 longData;
u8 boolData;
f64 doubleData;
} TnimcData;
Based on the attribute, the correct member of TnimcData must be set as follows:
- For TnimcMotionIODataForwardLimitEnable and TnimcMotionIODataReverseLimitEnable, set boolData in the TnimcData structure to TnimcTrue to enable the hardware limit, and TnimcFalse to disable the hardware limit.
- For TnimcMotionIODataForwardSoftwareLimitEnable and TnimcMotionIODataReverseSoftwareLimitEnable, set boolData in the TnimcData structure to TnimcTrue to enable the software limit, and TnimcFalse to disable the software limit.
- For TnimcMotionIODataHomeInputEnable, set boolData in the TnimcData structure to TnimcTrue to enable the home input, and TnimcFalse to disable home input.
- For TnimcMotionIODataForwardLimitActiveState, TnimcMotionIODataReverseLimitActiveState, and TnimcMotionIODataHomeInputActiveState, set boolData in the TnimcData structure to TnimcFalse to set the active state to active high/active closed and TnimcTrue for active low/active open.
- For TnimcMotionIODataForwardSoftwareLimitPosition and TnimcMotionIODataReverseSoftwareLimitPosition, set doubleData in the TnimcData structure to the value at which you want the software limit to trigger. Software limit positions can be anywhere within the 32-bit position range, –(231) to +(231–1).
Note TnimcMotionIODataForwardSoftwareLimitPosition cannot be less than TnimcMotionIODataReverseSoftwareLimitPosition. - For TnimcMotionIODataInhibitInEnable, set boolData in the TnimcData structure to TnimcTrue to enable inhibit-in, and set it to TnimcFalse to disable inhibit-in. When the inhibit-in signal is active and enabled, the motion controller kill stops the axis. Refer to Stop Motion for information about kill stop. Connect the inhibit-in signal to the Servo Alarm signal from the drive.
- For TnimcMotionIODataInhibitInActiveState, set boolData in the TnimcData structure to TnimcFalse to set the active state to active high/active closed, and set it to TnimcTrue to set the active state to active low/active open.
- For TnimcMotionIODataInPositionActiveState, set boolData in the TnimcData structure to TnimcFalse to set the active state to active high/active closed, and set it to TnimcTrue to set the active state to active low/active open.
- For TnimcMotionIODataPulseAlarmClear, set boolData in the TnimcData structure to TnimcTrue to pulse the alarm clear signal on for the time set in TnimcMotionIODataAlarmClearPulseWidth.
Note Use Clear Faults instead of this attribute to clear faults on all axes. - For TnimcMotionIODataAlarmClearPulseWidth, set doubleData in the TnimcData structure to the time, in seconds, that you want the alarm clear signal to be active. Valid range is 0 – 60 s.
Note The pulse is software-timed and is accurate to approximately ±1 ms. - For TnimcMotionIODataDriveReadyEnable set boolData in the TnimcData structure to TnimcTrue to enable the drive ready input, and set it to TnimcFalse to disable the drive ready input.
- For TnimcMotionIODataInhibitOutEnable set boolData in the TnimcData structure to TnimcTrue to enable the inhibit-out output, and set it to TnimcFalse to disable the inhibit-out output.
- For TnimcMotionIODataInhibitOutTotemPole, set boolData in the TnimcData structure to TnimcFalse to select open collector as the output configuration, and set it to TnimcTrue to select totem pole as the output configuration for the inhibit outputs.
- For TnimcMotionIODataInhibitOutActiveState, set boolData in the TnimcData structure to TnimcFalse to set the active state to active high/active closed, and set it to TnimcTrue to set the active state to active low/active open.
Using This Function
Use this function to load configuration parameters for the motion inputs and outputs on the motion controller. This function allows you to set all attributes on a per axis basis.
Hardware limit inputs, home inputs, software position limits, inhibit inputs, in-position inputs, drive ready inputs, and inhibit outputs are enhancements on the NI motion controllers and are not required for basic motion control. With the exception of the Find Reference function, you can operate all motion control functions without enabling or using these features. The Find Reference function requires enabled limit and home inputs for operation. Find Reference does not require enabled software limits.
Caution National Instruments recommends using limits for personal safety, as well as to protect the motion system. |
The active state for each hardware limit, home, inhibit input, in-position input, and inhibit output can be configured as either active low/active open or active high/active closed.
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.
Forward and Reverse Limits, and Home Inputs
The hardware limit inputs are typically connected to end-of-travel limit switches or sensors. An enabled limit input causes a halt stop on the axis when the input becomes active. Active limit inputs also prohibit attempts to start motion that would cause additional travel in the direction of the limit. You also can use limit inputs as general-purpose inputs and read their status with the Read Motion I/O Data function.
Note For the end-of-travel limits to function correctly, the forward limit switch or sensor must be located at the positive (count up) end of travel and the reverse limit at the negative (count down) end of travel. |
An enabled home input causes a halt stop on the axis when the input becomes active. Refer to Stop Motion for information about halt stop. You also can use a home input as a general-purpose input and read its status with the Read Motion I/O Data function.
Similar to hardware limits, software limits are often used to restrict the range of travel further and avoid hitting the hardware limit switches. An enabled software limit causes the axis to smoothly decelerate to a stop when the limit position is reached or exceeded. To enable the software limits, you must first find the reference point using the Find Reference function. The forward software limit is considered active if the current position is greater than or equal to the forward software limit position. The reverse software limit is considered active if the current position is less than or equal to the reverse software limit position.
Software limits are often used to restrict the range of travel and avoid hitting the hardware end-of-travel limit switches. For example, the motor can travel at a high velocity until hitting the software limit switch, and then move more slowly until it hits the hardware limit switch.
Note After an axis has stopped when it encounters a software limit switch, you can still move further in the same direction if you command the axis to do so. This behavior is not possible with hardware limits, but is appropriate for software limits. |
Note If any axis in a coordinate move exceeds an enabled software limit position, all axes in the coordinate decelerate to a stop. |
Even when disabled, you can poll the software limits with the host computer to warn of an out-of-range position. Refer to the Read Motion I/O Data function for information about reading the forward and reverse software limit status.
Inhibit Input
Use the inhibit-in input to connect a drive alarm/servo alarm signal to the motion controller so that when an alarm or other drive fault occurs, the motion is stopped using a kill stop. A kill stop asserts inhibit-out, disabling the control loop and zeroing the DAC so that frictional forces stop the motion.
In-Position Input
Use the In-Position drive signal when the drive is closing the position loop, for example a servo drive that accepts p-command or digital signals. This signal tells the motion controller when the drive considers the motor to be at the commanded position.
When the In-Position drive signal is configured, the Move Complete status is linked to the state of the in-position input. The move is not considered complete unless the in-position input is active.
Note Refer to Write Trajectory Data to add or remove this signal from the move complete criteria. |
Alarm Clear Output
Use the Alarm Clear Output to pulse the alarm clear signal on one axis of your system. Asserting the Alarm Clear signal clears the drive faults. The output must remain active for a minimum time, which varies depending on your drive. Refer to your drive documentation for more information. Use the TnimcMotionIODataAlarmClearPulseWidth attribute to set this time.
Drive Ready Input
The drive ready input can be connected to the drive ready or servo ready output of the drive. The drive ready output is active during normal operation. If the drive ready input signal is inactive, calling Start Motion returns an error. All other VIs can be executed.
Tip Check the status of this input at power-on to verify that the controller is ready to start a move. |
Inhibit Output
When enabled, a per-axis inhibit output is linked to the motor off state of the corresponding axis. A killed axis (motor off) forces the corresponding inhibit output On. When the axis is active, the inhibit output is Off. Note that these On and Off states are logical states. The actual state depends on the polarity of the system.
Inhibit outputs are typically used to disable the servo amplifier or stepper drive for power saving, safety, or specific application reasons.
Note Killing a servo axis also zeros its DAC output. With torque block amplifiers, this means that the motor freewheels regardless of if the amplifier is disabled. With velocity block servo amplifiers or stepper drives, the motor does not freewheel unless the amplifier/drive is disabled with the inhibit output. |
You also can use inhibit outputs as general-purpose outputs. Disabled inhibit outputs ignore the state of their corresponding axis and can be directly controlled through the Set Inhibit Output MOMO function.
For more information about Open Collector and Totem Pole drive modes, refer to the NI 7350 Hardware User Manual.
Remarks
This section includes information about how the behavior of this function differs among the controllers that support it.
NI 73xx Controller Considerations
The following list includes considerations you must make when you are using this function with a 73xx controller:
- 7330, 7340, and 7350 controllers do not support the TnimcMotionIODataInhibitInActiveState and TnimcMotionIODataInPositionActiveState attributes. Use Write Digital I/O Data to set the active state for these signals.
- 7330, 7340, and 7390 controllers do not support the TnimcMotionIODataInhibitOutTotemPole attribute.
- 7390 controllers do not support the TnimcMotionIODataInhibitOutActiveState attribute. To set the active state on a 7390 use Write Digital I/O Data.
- The inhibit-in signal is software-timed latched at 1 ms. This signal must be active for approximately 1 ms to be detected by the controller.
- The following table lists the drive signals and their implementation on the controller:
Signal Name Signal
DirectionController Support Controller Drive 7330 7340 7350 7390 Inhibit-Out Servo On Output Dedicated Dedicated Dedicated Mappable Inhibit-In Servo Alarm Input Mappable Mappable Mappable Dedicated Drive Ready Servo Ready Input Mappable Mappable Mappable Mappable In-Position In-Position Input Mappable Mappable Mappable Dedicated Alarm Clear Alarm Clear Output Mappable Mappable Mappable Mappable The active state of a dedicated signal is directly configurable using this function. The active state of a mappable signal is determined by the active state of the line being used.
For example, to set the active state of the Alarm Clear signal, a mappable signal on all controllers, set the active state of the line the signal is mapped to using the Write Digital I/O Data function.
To set the active state of the inhibit-in signal on a PCI-7390, which has a dedicated line for this signal, use the TnimcMotionIODataInhibitInActiveState attribute of this function.
NI SoftMotion Controller Considerations
The following list includes considerations you must make when you are using this function with the NI SoftMotion Controller:
- NI SoftMotion Controllers do not have to connect the Alarm signal from the drive in order to use the inhibit-in signal.
- The NI SoftMotion Controller does not support the following attributes:
- TnimcMotionIODataInPositionActiveState
- TnimcMotionIODataPulseAlarmClear
- TnimcMotionIODataAlarmClearPulseWidth
- TnimcMotionIODataDriveReadyEnable
- TnimcMotionIODataInhibitOutEnable
- TnimcMotionIODataInhibitOutTotemPole
- TnimcMotionIODataInhibitOutActiveState