flex_read_cap_pos

NI-Motion Functions

flex_read_cap_pos

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 Captured Position

Usage

status = flex_read_cap_pos(u8 boardID, u8 axisOrEncoder, u8 returnVector);

Purpose

Reads a captured position value from an axis or encoder.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axisOrEncoder u8 axis or encoder to read
returnVector u8 destination for the return data

Parameter Discussion

axisOrEncoder is the axis or encoder to read. Valid values are NIMC_AXIS1 through NIMC_AXIS30 or NIMC_ENCODER1 through NIMC_ENCODER30. On motion controllers that support fewer than thirty axes, reading non-existent axes or encoders returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes and Encoders for axis and encoder 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 the value in the single high-speed capture register of the axis or encoder selected. This value was captured when an enabled high-speed capture input went active.

For buffered high-speed capture, the captured positions are stored in a buffer. Use Read Buffer to read the captured positions.

High-speed capture functionality is performed by the encoder resources themselves. When this function is sent to an axis, the value returned is actually from the mapped encoder resource.

Refer to the Enable High-Speed Capture and Read High-Speed Capture Status functions for more information about the high-speed capture inputs and typical applications.

Note  For closed-loop stepper motion systems in which the encoder counts per revolution differs from the steps per revolution, the captured position is in encoder counts.