flex_configure_encoder_filter

NI-Motion Functions

flex_configure_encoder_filter

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

Configure Encoder Filter

Usage

status = flex_configure_encoder_filter(u8 boardID, u8 axisOrEncoder, u16 frequency);

Purpose

Selects the maximum count frequency for an encoder channel by configuring its digital filter.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axisOrEncoder u8 axis or encoder to configure
frequency u16 maximum count frequency selector

Parameter Discussion

axisOrEncoder is the axis or encoder to configure. Valid values are NIMC_AXIS1 through NIMC_AXIS30 or NIMC_ENCODER1 through NIMC_ENCODER30. On motion controllers that support fewer than thirty axes, configuring non-existent axes or encoders returns error –70006 (NIMC_badResourceIDOrAxisError). For configuring encoders mapped to axes, you can call this function on the axis or directly on its mapped encoder. Refer to Axes and Encoders for axis and encoder resource IDs.

frequency selects the maximum count frequency for the specified encoder.

frequency Value Maximum Count Frequency Max Count Frequency Constant
0 25.6 MHz NIMC_ENCODER_FILTER_25_6MHz
1 12.8 MHz NIMC_ENCODER_FILTER_12_8MHz
2 6.4 MHz NIMC_ENCODER_FILTER_6_4MHz
3 3.2 MHz NIMC_ENCODER_FILTER_3_2MHz
4 1.6 MHz (default) NIMC_ENCODER_FILTER_1_6MHz
5 800 kHz NIMC_ENCODER_FILTER_800KHz
6 400 kHz NIMC_ENCODER_FILTER_400KHz
7 200 kHz NIMC_ENCODER_FILTER_200KHz
8 100 kHz NIMC_ENCODER_FILTER_100KHz
9 50 kHz NIMC_ENCODER_FILTER_50KHz
10 25 Hz NIMC_ENCODER_FILTER_25KHz

Using This Function

Setting the maximum allowable count frequency for an encoder is useful for reducing the effect of noise on the encoder lines. Noise on the encoder lines can be interpreted as extra encoder counts. By setting the frequency to the lowest possible setting required for the motion application, you can ensure the highest degree of accuracy in positioning. In choosing the appropriate value, you must take into account the counts per revolution of the encoder and the maximum velocity for the axis in question.

For example, with a 20,000 counts per revolution encoder and a maximum velocity of 3,000 RPM (50 revolutions per second), the encoder signal could be as high as 1,000,000 counts per second. A frequency value of 4, which would correspond to a maximum count frequency of 1.6 MHz would be appropriate in this case.

If you never call this function, a default value of 4 (1.6 MHz) is used.

Tip  When the encoder filter is changed, reset the position to prevent an erroneous count.