flex_configure_stepper_output

NI-Motion Functions

flex_configure_stepper_output

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 Stepper Output

Usage

i32 status = flex_configure_stepper_output (u8 boardID, u8 axisOrStepperOutput, u16 outputMode, u16 polarity, u16 driveMode);

Purpose

Configures the drive mode, output mode, and polarity of a stepper output.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axisOrStepperOutput u8 axis or stepper output to configure
outputMode u16 specifies the output mode
polarity u16 sets the polarity for the stepper output
driveMode u16 specifies the drive mode

Parameter Discussion

axisOrStepperOutput is the axis or stepper output to configure. Valid values are NIMC_AXIS1 through NIMC_AXIS30 or NIMC_STEP_OUTPUT1 through NIMC_STEP_OUTPUT30. On motion controllers that support fewer than thirty axes, configuring non-existent axes or stepper outputs returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes and Stepper Outputs for axis and stepper output resource IDs. When sent to a stepper axis, this function configures the mapped stepper output. Alternatively, you can execute this function directly on the stepper output resource.

outputMode specifies the mode as Step and Direction or Clockwise/Counterclockwise.

Constant Value Description
NIMC_CLOCKWISE_COUNTERCLOCKWISE 0 Configures the mode as Clockwise/Counterclockwise
NIMC_STEP_AND_DIRECTION 1 Configures the mode as Step and Direction

polarity is the stepper output configured as active low or active high. When configured as active low, the output is active when there is a low signal on the output pin. Conversely, active high means that the output is active when there is a high signal on the output pin.

Constant Value Description
NIMC_ACTIVE_HIGH 0 Logical True or On
NIMC_ACTIVE_LOW 1 Logical False or Off

driveMode specifies either Open Collector or Totem Pole mode. driveMode is available only on the 7350 and is not configurable on 7330/40/90 motion controllers.

Constant Value Description
NIMC_OPEN_COLLECTOR 0 Configures output to be Open Collector
NIMC_TOTEM_POLE 1 Configures output to be Totem Pole

Using This Function

Use this function to configure a stepper output to correctly interface with a stepper driver. NI-Motion supports the two industry standards for stepper control outputs. The most popular mode is Step and Direction, where one output produces the step pulses and the other output produces a direction signal.

In Clockwise/Counterclockwise (CW/CCW) mode, the first output produces pulses when moving forward, or CW, while the second output produces pulses when moving reverse, or CCW.

In either mode, you can set the active polarity with the polarity bit to active low or active high. For example, in Step and Direction mode, the polarity bits determine if a high direction output is forward or reverse. It also determines the resting states of outputs when they are not pulsing.

The Configure Stepper Output function is typically called for each stepper axis prior to using the axis for position control. After the modes and polarity are set, they remain in effect until changed. You can execute this function at any time.

For the 7350 controller, you can set the stepper output driveMode to Open Collector or Totem Pole. On the 7330/40, stepper output is Open Collector and cannot be changed. On the 7390, stepper output is isolated so driveMode does not apply and cannot be changed. For more information about Open Collector and Totem Pole drive modes, refer to the documentation for your 7350 device.