flex_configure_encoder_polarity

NI-Motion Functions

flex_configure_encoder_polarity

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 Polarity

Usage

i32 status = flex_configure_encoder_polarity (u8 boardID, u16 indexPolarityMap, u16 phaseAPolarityMap, u16 phaseBPolarityMap);

Purpose

Configures the encoder Phase A, Phase B, and Index line polarities.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
indexPolarityMap u16 sets the polarity for encoder Index
phaseAPolarityMap u16 sets the polarity for encoder Phase A
phaseBPolarityMap u16 sets the polarity for encoder Phase B

Parameter Discussion

indexPolarityMap sets the polarity for encoder Index to active low or active high.

D8 D7 D6 D5 D4 D3 D2 D1 D0
Encoder 8 Encoder 7 Encoder 6 Encoder 5 Encoder 4 Encoder 3 Encoder 2 Encoder 1 0

D1 through D8:
   1 = Active low
   0 = Active high

phaseAPolarityMap sets the polarity for encoder Phase A to active low or active high.

D8 D7 D6 D5 D4 D3 D2 D1 D0
Encoder 8 Encoder 7 Encoder 6 Encoder 5 Encoder 4 Encoder 3 Encoder 2 Encoder 1 0

D1 through D8:
   1 = Active low
   0 = Active high

phaseBPolarityMap sets the polarity for encoder Phase B to active low or active high.

D8 D7 D6 D5 D4 D3 D2 D1 D0
Encoder 8 Encoder 7 Encoder 6 Encoder 5 Encoder 4 Encoder 3 Encoder 2 Encoder 1 0

D1 through D8:
   1 = Active low
   0 = Active high

Using This Function

The Configure Encoder Polarity function configures the polarities for the encoder Phase A, Phase B, and Index lines. Configure encoder polarities before calling the Enable Encoders function.

You can configure the encoder polarity as active low or active high. When configured as active low, the input is active when there is a low signal on the input pin. Conversely, active high means that the input is active when there is a high signal on the input pin.

Note  Setting Phase A and Phase B incorrectly causes the feedback to appear to move in the opposite direction. For example, if Phase A or Phase B is the wrong polarity when moving in the forward direction, the position appears to move in the reverse direction. The opposite occurs when moving in the reverse direction. If both are set incorrectly, motion occurs in the correct direction but the index might not work correctly.