flex_add_vars |
Add Variables
Usage
status = flex_add_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector);
Purpose
Adds 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 adds the values in the two variables 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 Be careful when adding two large values. The result could overflow and wrap around. No error generates when an overflow occurs. |