flex_reset_encoder

NI-Motion Functions

flex_reset_encoder

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

Reset Encoder Position

Usage

status = flex_reset_encoder(u8 boardID, u8 encoder, i32 position, u8 inputVector);

Purpose

Resets the position of an unmapped encoder to the specified value.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
encoder u8 encoder to reset
position i32 reset value for encoder
inputVector u8 source of the data for this function

Parameter Discussion

encoder is encoder to reset. Valid values are NIMC_ENCODER1 through NIMC_ENCODER30. On motion controllers that support fewer than thirty axes, configuring non-existent encoders returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Encoders for encoder resource IDs.

position is the reset value for the encoder resource. You can reset position to any value in the total position range of –(231) to +(231–1).

inputVector indicates the source of the data for this function. Available input vectors include immediate (0xFF), variable (0x01 through 0x78), or indirect variable (0x81 through 0xF8). Refer to Input and Return Vectors for more detailed information.

Using This Function

The Reset Encoder Position function resets the position of the selected encoder. You can reset position to zero or to any value in the 32-bit position range. Normally, this function is only used on independent encoders that are not mapped to axes. For encoders mapped to axes, you must use the Reset Position function instead.

Note  Attempting to reset an encoder that is mapped to an axis generates an error.

Encoder position can be reset at any time. However, it is recommended that you reset position only while the encoder is stopped. A encoder reset while it is moving does not have a repeatable reference position.

Note  Non-zero reset values are useful for defining a position reference offset.

Enabled breakpoints are automatically disabled when you execute a Reset Position or Reset Encoder Position function on the corresponding axis.