Hardware manual

Expressions Impact Reference Guide
Datalogic Automation Inc. 5-4
Expressions
Expressions are used to assign and calculate values. They can contain variables, operators, function calls and
parentheses. Operators, unless they are surrounded by parentheses, are evaluated from left to right in the
order of precedence listed in the following table, starting with the highest precedence.
Examples:
6-3+3 = 6 (3 is subtracted from 6, then 3 is added to 3)
6-(3+3) = 0; (3 is added to 3, the result is subtracted from 6)
6-3/3 = 5; (3 is divided by 3 then subtracted from 6, division has a higher pre-
cedence)
Operator Operator Meaning
^ Power: raises the first operand to the power of the second operand (e.g. x = 2^2;
result is 4)
* Multiplication: multiplies the operands
/ Division: divides the left operand by the right operand (the result is undef if the
right operand is zero)
% Modulus: Calculates the remainder of the two operands. The operands are con-
verted to integer value (INT function, not rounded) and the result is integer (e.g. x
= 8%3; x is 2). If the second operand is zero, the result is undef.
+ Addition: adds the left operand to the right operand
- Subtraction: subtracts the right operand from the left operand and the result is the
signed difference
= Equality check: compares the operands, if they are equal the result is True (e.g. z
= 4>2). If one of the operands is undef, the result is False. If both operators are
undef, the result TRUE.
< Less than check: compares the operands, if the left operand is less than the right
operand the result is True (e.g. 2<4)*
<= Less than or equal check: compares the operands, if the left operand is less than
or equal to the right operand the result is True (e.g. 2<=4)*
> Greater than check: compares the operands, if the left operand is greater than the
right operand the result is True (e.g. 4>2)*
>= Greater than or equal check: compares the operands, if the left operand is greater
than or equal to the right operand the result is True (e.g. 4>=2)*
<> Not equal check: compares the operands, if the left operand is not equal to the
right operand the result is True (e.g. 4<>2) If both operators are undef the result is
False. If only one of the operands is undef then the result is True.
AND AND: joins two or more conditional expressions; if both conditional expressions
are true, the entire expression is true. If one or none are true, the entire expres-
sion is false.
OR OR: joins two or more conditional expressions; If either or both expressions are
true, the entire expression is true. If neither is true, the expression is false.
XOR Logical and bit-wise: calculates the logical and bit-wise Exclusive OR of the oper-
ands