flex_div_vars

NI-Motion Functions

flex_div_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

Divide Variables

Usage

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

Purpose

Divides the value in the first variable by the value in the second variable and returns the result.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
variable1 u8 dividend
variable2 u8 divisor
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 divides the value in the first variable by the value in the second variable and returns the result to the destination specified by the returnVector.

V1 / 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 condition codes are set according to the resulting value. This value is compared with 0, and the appropriate condition code is set: GREATER THAN, LESS THAN, or EQUAL to zero.

Note  This function does an integer divide and the remainder is lost.
Note  If V2 = 0, this function returns an invalid function data modal error (–70078).