flex_and_vars

NI-Motion Functions

flex_and_vars

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

AND Variables

Usage

status = flex_and_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector);

Purpose

Performs a bitwise AND of the values in the two variables and returns the result.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
variable1 u8 first operand
variable2 u8 second operand
returnVector u8 destination for the result

Parameter Discussion

variable1 is the variable holding the first operand. Valid inputs are variables (0x01 through 0x78) and indirect variables (0x81 through 0xF8).

variable2 is the variable holding the second operand. Valid inputs are variables (0x01 through 0x78) and indirect variables (0x81 through 0xF8).

returnVector indicates the destination for the return data generated by this function. Available return vectors include return data to the host (0xFF), to a variable (0x01 through 0x78), to an indirect variable (0x81 through 0xF8), and return no data (0). Refer to Input and Return Vectors for more detailed information.

Using This Function

This function performs a bitwise logical AND of the values in the two variables and returns the result to the destination specified by the returnVector.

V1 AND V2 = Result

where:
V1 is the value at variable1.
V2 is the value at variable2.
Result is stored in the location pointed to by returnVector.

The result can be returned to a new variable or one of the two input variables, returned to the host computer, or thrown away. In all cases the EQUAL condition code is set True if the result equals zero (all bits low) and False if any bit is set. The GREATER THAN and LESS THAN codes are also set but can be confusing after logical bitwise operations.

Example

If the values in variable1 and variable2 are 0x0000 1234 and 0x0000 EEEE, respectively, the result of the bitwise AND is 0x0000 0224 which is NOT EQUAL to zero.