flex_config_mc_criteria

NI-Motion Functions

flex_config_mc_criteria

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

Configure Move Complete Criteria

Usage

status = flex_config_mc_criteria(u8 boardID, u8 axis, u16 criteria, u16 deadBand, u8 delay, u8 minPulse);

Purpose

Configures the criteria for the Move Complete status to be True.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axis u8 axis to configure
criteria u16 conditions that must be met for the MC status to be True
deadBand u16 tolerance area around target position
delay u8 settling time delay, in ms
minPulse u8 minimum time the MC status must stay true, in ms

Parameter Discussion

axis is the axis to configure. Valid values are NIMC_AXIS1 through NIMC_AXIS30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes for axis resource IDs.

criteria is the bitmap that defines the criteria for the move complete status to be True:

D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 0 0 0 0 0 0 In Pos Delay Stop MOff PC

D0 Profile Complete (PC):

1 = Profile must be complete (default)

0 = N/A (cannot reset)

D1 Motor Off (MOff):

1 = Motor is off or killed

0 = Motor off status not considered (default)

D2 Stop:

1 = Run/Stop must be stopped

0 = Run/Stop not considered (default)

D3 Delay:

1 = Move complete only after delay

0= Move complete not delayed (default)

D4 In-Position (In Pos):

1 = Must be within deadband of target position

0 = Ignore in-position status (default)

The effect of the criteria parameters can be summarized with the following equation:

Move Complete = (Profile Complete [OR Motor Off])
[AND (Run/ Stop == Stop)]
[AND (Delay == Done)]
[AND (| position - target position | < deadband)]
where [...] = optional criteria.

deadband is the tolerance around the target position, and has a range of 0 (default) to 32,767. If selected, the move is only considered complete when | position - target position | < deadband.

delay is a programmable settling time delay in ms. You can program it from 0 (default) to 255 ms.

minPulse is the minimum time, in ms, that the move complete status must stay true. This parameter allows you to enforce a minimum pulse width on the move complete status even if the axis is started again. This is the amount of time you have to read the move complete status before it is reset. The range is 0 (default) to 255 ms.

Using This Function

This function defines the conditions for reporting a move complete. When a move is complete on an axis, the corresponding bit in the Move Complete Status (MCS) register is set. Refer to the Read Move Complete Status function for information about reading the MCS register.

This function allows a great deal of control over when and how a move is considered complete. The criteria bitmap contains five bits to set the conditions used to determine the Move Complete status. The first two, Profile Complete and Motor Off, are logically OR'd to provide the basis for Move Complete. The Profile Complete bit is always set and cannot be disabled. When the axis trajectory generator completes its profile, this condition is satisfied. If the Motor Off bit is set, any condition that causes the axis to turn its motor off (a kill or following error trip) satisfies this basic requirement for Move Complete. In other words, either Profile Complete OR Motor Off must be True for Move Complete to be True.

The next three criteria, Run/Stop, Delay, and In Position, are optional conditions that are logically ANDed to further qualify the Move Complete status. If the Run/Stop bit is set, the axis must also be logically stopped for the move to be considered complete. Refer to the Load Run/Stop Threshold function for information about the Run/Stop status.

If the delay bit is set, the axis must wait a user-defined delay after the other criteria are met before the move is considered complete. The user-defined delay parameter is typically used to wait the mechanical settling time so that a move is not considered complete until vibrations in the mechanical system have damped out. It also can be used to compensate for PID pull-in time due to the integral term. This pull-in is typically at velocities below the Run/Stop threshold.

Finally, if the In-Position bit is set, the axis checks its final stopping position versus its target position and only sets the Move Complete status if the absolute value of the difference is less than the in-position deadband.

A non-zero value for minPulse guarantees the status stays in the True state for at least this minimum time, even if another move starts immediately. You can use this feature to make sure the host does not miss a Move Complete status when it polls the Move Complete Status register.

Note  You can use the Delay parameter to guarantee a minimum time for the False state. The status transitions from Complete to Not Complete at the start of a move and stays in the Not Complete state for at least this delay time even in the case of a zero distance move.
Tip  You can adjust move complete criteria settings in MAX on the Trajectory Settings.

This function is typically called for each axis prior to using the axis for position control. After the criteria are set, they remain in effect until changed. You can execute this function at any time.

When an axis starts, its corresponding bit in the Move Complete Status register is reset to zero. When the move completes, the bit is set to one. You can check the status of an axis or axes at any time by polling the MCS register. Onboard programs can use this status to automatically sequence moves with the Wait on Event function.

Tip  Use Write Trajectory Data for more move complete criteria options.