flex_read_steps_gen

NI-Motion Functions

flex_read_steps_gen

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

Usage

status = flex_read_steps_gen(u8 boardID, u8 axisOrStepperOutput, u8 returnVector);

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
returnVector u8 destination for the return data

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.

returnVector indicates the destination for the return data generated by this function. Available return vectors include return data to the host (0xFF), to a variable (0x01 through 0x78), to an indirect variable (0x81 through 0xF8), and return no data (0). Refer to Input and Return Vectors for more detailed information.

Note  The suffix _rtn on the function indicates that the data must be returned to the host. When this calling convention is used, no returnVector is required.

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.