flex_jump_on_event

NI-Motion Functions

flex_jump_on_event

Device Compatibility

Device Compatibility
7330
N
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Xenus
N
NI SoftMotion Controller for CANopen—Accelnet
N

Jump on Event

Usage

status = flex_jump_on_event(u8 boardID, u8 resource, u16 condition, u16 mustOn, u16 mustOff, u16 matchType, u16 labelNumber);

Purpose

Inserts a conditional jump in a program.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
resource u8 axis control or other resource
condition u16 qualifying condition for the jump
mustOn u16 bitmap of bits that must be True
mustOff u16 bitmap of bits that must be False
matchType u16 selector for type of match required
labelNumber u16 label number to jump to

Parameter Discussion

resource is the axis control or other resource involved in the condition.

condition is the qualifying condition for the jump.

condition Constant condition Value Valid resource
NIMC_CONDITION_LESS_THAN 0 N/A
NIMC_CONDITION_EQUAL 1 N/A
NIMC_CONDITION_LESS_THAN_OR_EQUAL 2 N/A
NIMC_CONDITION_GREATER_THAN 3 N/A
NIMC_CONDITION_NOT_EQUAL 4 N/A
NIMC_CONDITION_GREATER_THAN_OR_EQUAL  5 N/A
NIMC_CONDITION_TRUE 6 N/A
NIMC_CONDITION_HOME_FOUND 7 N/A
NIMC_CONDITION_INDEX_FOUND 8 N/A
NIMC_CONDITION_HIGH_SPEED_CAPTURE 9 0 (axes) or 0x20 (encoders)
NIMC_CONDITION_POSITION_BREAKPOINT 10 0 (axes) or 0x20 (encoders)
Reserved 11 N/A
NIMC_CONDITION_VELOCITY_THRESHOLD 12 N/A
NIMC_CONDITION_MOVE_COMPLETE 13 N/A
NIMC_CONDITION_PROFILE_COMPLETE 14 N/A
NIMC_CONDITION_BLEND_COMPLETE 15 0 (axes)
NIMC_CONDITION_MOTOR_OFF 16 N/A
NIMC_CONDITION_HOME_INPUT_ACTIVE 17 N/A
NIMC_CONDITION_LIMIT_INPUT_ACTIVE 18 N/A
NIMC_CONDITION_SOFTWARE_LIMIT_ACTIVE  19 N/A
NIMC_CONDITION_PROGRAM_COMPLETE 20 program
NIMC_CONDITION_IO_PORT_MATCH 21 I/O port 1-4

mustOn is the bitmap of bits that must be True to satisfy the condition.

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
XXX ... XXX XXX mustOn 8 mustOn 7 mustOn 6 mustOn 5 mustOn 4 mustOn 3 mustOn 2 mustOn 1 mustOn 0

For D0 through D8:
   1 = Bit must be True
   0 = Don't care (default)

mustOff is the bitmap of bits that must be False to satisfy the condition.

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
XXX ... XXX XXX mustOff 8 mustOff 7 mustOff 6 mustOff 5 mustOff 4 mustOff 3 mustOff 2 mustOff 1 mustOff 0

For D0 through D8:
   1 = Bit must be False
   0 = Don't care (default)

matchType selects the type of match required for the bitmap.

matchType Constant matchType Value
NIMC_MATCH_ALL 0
NIMC_MATCH_ANY 1

NIMC_MATCH_ANY means that a match of any bit (logical OR) is sufficient to satisfy the condition, while NIMC_MATCH_ALL requires a complete pattern match (logical AND) of all bits.

labelNumber is the arbitrary label number to jump to. Valid label numbers are from 1 to 65,535.

Using This Function

This function controls the flow of execution in a stored program by defining a conditional jump to any label within the program. In addition to condition codes set as the result of a previous data operations function, you can test virtually any instantaneous status of axes or resources to decide if you should execute a jump.

There are two distinct groups of conditions. The first group, conditions 0 through 6, test the result of the most recent logical, mathematical or data transfer operations function. Refer to the Data Operations Functions for more information about mathematical or data transfer operations. These condition codes test if the result of the latest logical, mathematical, or data transfer function is less than zero, equal to zero, less than or equal to zero, greater than zero, not equal to zero, or greater than or equal to zero. For these conditions, the resource, mustOn, mustOff, and matchType parameters are not required and their values are ignored.

Note  You can program unconditional jumps by setting the condition to NIMC_CONDITION_TRUE (6).

The second group, conditions 7 and above, test a specific multi-axis, multi-vector space, multi-encoder, program, motion I/O, or general-purpose I/O status. Where applicable, you can select the specified resource with the resource parameter.

NIMC_CONDITION_PROGRAM_COMPLETE is similar to the first condition group in that mustOn, mustOff, and matchType parameters are not required and their values are ignored. You set resource equal to the specified program number to test. The balance of the conditions in this group test status bitmaps and function similar to each other as described in the remainder of this section.

The mustOn, mustOff, and matchType parameters work together to define a bitmap of True and False bits that must be matched to satisfy the condition. The matchType parameter allows you to select between an OR match, where any matching bit is sufficient, and an AND match, where all status bits must match the True/False bitmap defined by mustOn and mustOff.

Using the MustOn/MustOff protocol gives you tri-state control over each match bit: True, False or Don't care. A one (1) in a bit location of the MustOn bitmap sets the match bit to True, while a one (1) in the corresponding location of the MustOff bitmap resets the match bit to False. A zero (0) in either bitmap has no affect, so leaving both the MustOn and MustOff bits at zero defines the bit as Don't care. If you set both the MustOn and MustOff bits to one (1), it is interpreted as a MustOn condition and the match bit is set to True.

The NIMC_CONDITION_LIMIT_INPUT_ACTIVE and NIMC_CONDITION_SOFTWARE_LIMIT_ACTIVE conditions create a combined status bitmap where if either the forward or reverse limit is active, the bit is True.

Example

To perform a conditional jump to label 99 if either axis 3 is move complete or axis 4 is still moving (move not complete), call the Jump to Label on Condition function with the following parameters:

   condition = NIMC_CONDITION_MOVE_COMPLETE (13)

   mustOn = 0x08, which corresponds to the following bitmap:

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
XXX ...  XXX XXX mustOn 8 mustOn 7 mustOn 6 mustOn 5 mustOn 4 mustOn 3 mustOn 2 mustOn 1 mustOn 0
0 ...  0 0 0 0 0 0 0 1 0 0 0

   mustOff = 0x20, which corresponds to the following bitmap:

D15 ... D10 D8 D8 D7 D6 D5 D4 D3 D2 D1 D0
XXX ... XXX XXX mustOn 8 mustOn 7 mustOff 6 mustOff 5 mustOff 4 mustOff 3 mustOff 2 mustOff 1 mustOff 0
0 ...  0 0 0 0 0 0 1 0 0 0 0

   matchType = NIMC_MATCH_ANY (1)

   labelNumber = 99

In this example, the move complete status of axes 1 and 2 are do not care and the matchType is set to match either axis 3 move complete (On) or axis 4 move not complete (Off).