flex_reset_pos

NI-Motion Functions

flex_reset_pos

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

Reset Position

Usage

status = flex_reset_pos(u8 boardID, u8 axis, i32 position1, i32 position2, u8 inputVector);

Purpose

Resets the axis position to the specified position, taking following error into account.

Note  If you are using this function with an NI 7350 or NI 7390 device that you are reading positions on, it might take up to 5 ms for the application to display the most recently read position after you call this function.
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 control
position1 i32 reset value for axis and primary feedback resource
position2 i32 reset value for secondary feedback resource
inputVector u8 source of the data for this function

Parameter Discussion

axis is the axis to control. 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.

position1 is the reset value for the axis and its associated primary feedback resource, taking following error into account. You can reset position to any value in the total position range of –(231) to +(231–1).

position2 is the reset value for the optional secondary feedback resource. You can reset position to any value in the total position range of –(231) to +(231–1).

Note  For stepper closed-loop configurations, where the encoder counts per revolution is greater than the steps per revolution, the range of the position parameters is reduced by the ratio of counts/rev to steps/rev. For example, if the ratio is 4,000 counts per revolution to 2,000 steps per revolution (2:1 ratio), then the range of position parameters is divided by 2.

inputVector indicates the source of the data for this function. Available input vectors include immediate (0xFF), variable (0x01 through 0x78), or indirect variable (0x81 through 0xF8). Refer to Input and Return Vectors for more detailed information.

Using This Function

This function resets the axis position and the associated primary feedback position, taking following error into account, and resets the optional secondary feedback position. This means that if you reset the position to 0 and have a following error of 15, the feedback position is –15.

You can reset position to zero or any value in the 32-bit position range. You can reset the secondary feedback to the same value as the axis and primary feedback or you can reset it to a different value. If a secondary feedback resource is not in use, the corresponding reset value is ignored.

Note  Non-zero reset values are useful for defining a position reference offset.

Position can be reset at any time. However, it is recommended that you reset position only while the axis is stopped. An axis reset while the axis is moving does not have a repeatable reference position.

Note Note  For axes in p-command mode, ensure that the axis is not moving before calling Reset Position. Calling Reset Position when the axis is moving introduces position error into the system.

Typically, you execute this function one time after the Find Home and Find Index sequences of the Find Reference function have completed successfully to set the zero position for the system and do not call it again until the next power-up.

Note  Enabled breakpoints are automatically disabled when you execute a Reset Position or Reset Encoder Position function on the corresponding axis.

An ADC channel used as a primary feedback resource is reset by storing an offset value when this function is executed. In this way, its zero reference is not lost and you can still read the actual ADC value with the Read ADC function.

Resetting position sets the value returned by steps/revolution to the primary reset position.

Note  National Instruments recommends disabling gearing before resetting the position of the master axis or the slave axis. When the position of either the master axis or the slave axis is reset, the reset offset is treated as gearing offset, and the slave axis jumps to the new gear position in one PID period.

Remarks

This section includes information about how the behavior of this function differs among the controllers that support it.

NI SoftMotion Controller Considerations

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

  • The secondary reset position is ignored.
  • When you reset a slave position, gearing is not disabled.
    Note  National Instruments recommends that you do not reset the position when an axis is moving or gearing is enabled because doing so might cause the axis to jump and/or cause a following error.