flex_load_reference_parameter

NI-Motion Functions

flex_load_reference_parameter

Device Compatibility

Device Compatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Xenus
Y
NI SoftMotion Controller for CANopen—Accelnet
Y

Load Reference Parameter

Usage

status = flex_load_reference_parameter(u8 boardID, u8 axis, u8 findType, u16 attribute, f64 value);

Purpose

Loads the value for the specified find reference parameter.

Tip  Refer to the Remarks section for information about how the behavior of this function differs between controllers.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axis u8 axis to configure
findType u8 sets the type of find reference search for which to load the attribute
attribute u16 the attribute to load
value f64 the input for the attribute you are loading

Parameter Discussion

axis is the axis to configure with this function. Valid values are NIMC_AXIS1 through NIMC_AXIS30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes for axis resource IDs.

findType sets the type of find reference search for which to load the attribute. Valid inputs are as follows:

  • NIMC_FIND_HOME_REFERENCE
  • NIMC_FIND_INDEX_REFERENCE
  • NIMC_FIND_CENTER_REFERENCE
  • NIMC_FIND_FORWARD_LIMIT_REFERENCE
  • NIMC_FIND_REVERSE_LIMIT_REFERENCE

attribute is the attribute to load. The following table includes valid attributes.

Attribute Number
NIMC_INITIAL_SEARCH_DIRECTION 0x0
NIMC_FINAL_APPROACH_DIRECTION 0x1
NIMC_EDGE_TO_STOP_ON 0x2
NIMC_SMART_ENABLE 0x3
NIMC_ENABLE_RESET_POSITION 0x4
NIMC_OFFSET_POSITION 0x5
NIMC_PRIMARY_RESET_POSITION 0x6
NIMC_SECONDARY_RESET_POSITION 0x7
NIMC_APPROACH_VELOCITY_PERCENT 0x8
NIMC_SEQUENCE_SEARCH_ORDER 0x9
NIMC_ENABLE_SEARCH_DISTANCE 0xA
NIMC_SEARCH_DISTANCE 0xB
NIMC_PHASE_A_REFERENCE_STATE 0xC
NIMC_PHASE_B_REFERENCE_STATE 0xD

value is the input for the attribute you are loading. Valid values for each attribute are listed in the following section.

Using This Function

Use this function to load the parameters for Find Reference. The following are valid values for each attribute:

  • Initial Search Direction—Enter true to search in the reverse direction. Enter false (default) to search in the forward direction.
  • Final Approach Direction—Valid values are true or false (default). The following table lists the behavior of the Final Approach Direction parameter for each type of find:

    Find Type Final Approach Direction is True Final Approach Direction is False
    Find Home reverse approach forward approach
    Find Center
    Find Forward Limit
    Find Reverse Limit
    opposite to direction of travel into limit same as the direction of travel into limit
    Find Index N/A N/A


    Note  For Find Center, this value refers to how the controller behaves when approaching and marking the position of the limits to find their center.
  • Edge to Stop On—Applies only to Find Home. If true, reverse edge. If false (default), forward edge.
  • Approach Velocity Percent—The percent of the loaded velocity that a given axis uses to perform final adjustments. Refer to the Remarks section for valid values.

    Find Index uses this % velocity throughout the entire search routine.
  • Smart Enable—If true, appropriately enables or disables the limits and home input before executing a find. The limits and home input are returned to their original state after the find operation is complete. To determine what state Smart Enable sets the limits or home input to, reference the appropriate Search Type description. If false, you must manually enable or disable the limits or home input.
  • Enable Reset Position—If true, after successfully locating the given reference, it resets primary and secondary positions to values indicated by Primary Reset Position and Secondary Reset Position. The reset is performed after the offset move if one is requested. If the find operation fails, the position is not reset. If false, no reset is performed.
  • Offset Position—Performs an offset move of a given distance, in counts (steps), after successfully locating the given reference, but before resetting the position if a reset is requested. Valid inputs range from –231–1 to 231–1. An offset of 0 is equivalent to not performing an offset move. If the find operation fails, the offset move does not occur.
  • Primary Reset Position—The position to reset the primary position to. Will only reset if Enable Reset Position is true. Valid values range from –231–1 to 231–1.
  • Secondary Reset Position—The position to reset the secondary position to. Will only reset if Enable Reset Position is true. Valid values range from –231–1 to 231–1.
  • Sequence Search Order—The order number for a find sequence. Valid values range from 0 to 216–1. Refer to the Run Sequence description for more information.
  • Enable Search Distance—If true, Find Reference uses the value loaded for Search Distance when searching for an index. If false, Find Reference uses a set distance of 1 1/16th revolution. The default is false.
  • Search Distance—The distance Find Reference searches for an index before giving up. Valid values range from 0 to 231–1 counts.
  • Phase A Reference State—The logical state of encoder phase A when an index is found. Use this in conjunction with the encoder polarity to configure the criteria for index status. Enter 1 for inactive or 0 for active.
  • Phase B Reference State—The logical state of encoder phase B when an index is found. Use this in conjunction with the encoder polarity to configure the criteria for index status. Enter 1 for inactive or 0 for active.

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 motion controller:

  • For the NI 73xx controllers, NIMC_APPROACH_VELOCITY_PERCENT is a single-precision floating-point value from 0.4% to 150%. This value directly scales the programmed velocity. The default value is 20%.
  • The resolution of NIMC_APPROACH_VELOCITY_PERCENT is approximately 0.4%.

NI SoftMotion Controller Considerations

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

  • NIMC_SECONDARY_RESET_POSITION is not supported by the NI SoftMotion Controller.
  • NIMC_PHASE_A_REFERENCE_STATE and NIMC_PHASE_B_REFERENCE_STATE are not supported on CANopen devices.
  • NIMC_PRIMARY_RESET_POSITION must be set to 0 when you are using the NI SoftMotion Controller for the Copley Controls CANopen drives, Accelnet and Xenus.
  • The NI SoftMotion Controller supports the full 64-bit floating point range for NIMC_APPROACH_VELOCITY_PERCENT.
  • The NI SoftMotion Controller requires that Search Distance, and thus, Enable Search Distance is always true (1).