flex_read_cap_pos_rtn |
Read Captured Position Return
Usage
status = flex_read_cap_pos_rtn(u8 boardID, u8 axisOrEncoder, i32* capturedPosition);
Purpose
Reads a captured position value from an axis or encoder.
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) |
axisOrEncoder | u8 | axis or encoder to read |
capturedPosition | i32* | position value captured |
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.
capturedPosition is the position value captured when the corresponding high-speed capture input went active.
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. |
Remarks
This section includes information about how the behavior of this function differs among the controllers that support it.
NI 73xx Controller Considerations
The following list includes considerations you must make when you are using this function with a 73xx motion controller:
- NI 73xx controllers do not support multiple simultaneous high-speed captures per axis. NIMC_SECOND_HS_CAPTURE is not supported.
NI SoftMotion Controller Considerations
The following list includes considerations you must make when you are using this function with the NI SoftMotion Controller:
- The NI SoftMotion Controller supports multiple simultaneous high-speed captures per axis
To read the captured position on an axis, use the constant for that axis. For example, if the first high-speed capture is on axis 1, the function call appears as
status = flex_read_cap_pos_rtn (boardID, NIMC_AXIS1, &capturedPosition);
To read the captured position on the secondary high-speed capture line, use the second high-speed capture constants NIMC_SECOND_HS_CAPTURE1 through NIMC_SECOND_HS_CAPTURE30. For example, if the second high-speed capture is on axis 1, the function call appears as
status = flex_read_cap_pos_rtn (boardID, NIMC_SECOND_HS_CAPTURE1, &capturedPosition);
- The NI SoftMotion Controller for Copley Controls' Accelnet and Xenus CANopen drives does not support multiple simultaneous high-speed captures per axis. NIMC_SECOND_HS_CAPTURE is not supported.