flex_read_steps_gen_rtn

NI-Motion Functions

flex_read_steps_gen_rtn

Device Compatibility

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

Read Steps Generated Return

Usage

status = flex_read_steps_gen_rtn(u8 boardID, u8 axisOrStepperOutput, i32* steps);

Purpose

Reads the number of steps generated by a stepper output.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axisOrStepperOutput u8 axis or stepper output to read
steps i32* is a value based on actual steps generated, as opposed to feedback position.

Parameter Discussion

axisOrStepperOutput is the axis or stepper output to read. Valid values are NIMC_AXIS1 through NIMC_AXIS30 or NIMC_STEP_OUTPUT1 through NIMC_STEP_OUTPUT30. On motion controllers that support fewer than thirty axes, reading non-existent axes or stepper outputs returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes and Stepper Outputs for axis and stepper output resource IDs.

steps is the number of steps generated because the stepper axis last had its position reset.

Using This Function

This function returns a number based on steps generated by a stepper axis or stepper output resource. For open-loop stepper axes, this function returns exactly the same value as the Read Position function.

For closed-loop stepper axes, this function returns the actual number of steps generated while the Read Position function returns the feedback position converted from counts to steps. The number of steps generated includes extra steps added during any pull-in move required to reach the target position.

To reset the value returned by this function, use Reset Position. Reset Position sets the steps parameter to the reset position value.

Closed-Loop Stepper Example

Suppose you execute a move from position 0 to position 100, and 10 additional steps are generated for the pull-in move. Read Position returns 100, but Read Steps Generated returns 110. If you execute another move to position 50, Read Position returns 50, and Read Steps Generated returns 60.