flex_read_pos_rtn

NI-Motion Functions

flex_read_pos_rtn

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

Read Position Return

Usage

status = flex_read_pos_rtn (u8 boardID, u8 axis, i32* position);

Purpose

Reads the position of an axis.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axis u8 axis to read
position i32* axis position in counts (servo) or steps (stepper)

Parameter Discussion

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

position is the axis position in quadrature counts (for servo axes) or steps (for stepper axes).

Using This Function

This function returns the instantaneous position of the specified axis. For servo axes, it returns the primary feedback position in counts. For open-loop stepper axes, it returns the number of steps generated. For closed-loop stepper axes, it converts the primary feedback position from counts to steps and then returns the value in steps. Closed-loop stepper axes require you to correctly load values of steps per revolution and counts per revolution to function correctly.

Note  For closed-loop axes, this function always returns the position of the primary feedback resource. Refer to the Read Vector Space Position function for an easy way to read up to three axis positions for a vector space in one call.