Programming manual.
CNC 8070
1.
CREATING A PROGRAM.
Arithmetic and logic operators and functions.
·50·
(REF: 1709)
1.11 Arithmetic and logic operators and functions.
An operator is a symbol that indicates the mathematical or logic operations to carry out. The
CNC offers the following types of operators.
Arithmetic operators.
To perform arithmetic operations.
In the operation, when using the parameter or variable storing the result, the add, subtract,
multiply and divide operators may be used as follows:
Relational operators.
Used for doing comparisons.
Binary operators.
Used for doing binary comparisons between constants and/or arithmetic expressions.
If the constant or the result of the arithmetic expression is a decimal number, the decimal
portion will be ignored.
Logic operators.
Used for doing logic comparisons between conditions.
Each condition should go between brackets, otherwise, an undesired comparison may be
done due to the priority between operators.
+ Add P1 = 3+4 P1=7
- Subtract
Change sign
P2 = 5-2
P2 = -[3+4]
P2=3
P2=-7
* Multiply P3 = 2*3 P3=6
/ Division P4 = 9/2 P4=4.5
MOD Module or remainder of a division P5 = 5 MOD 2 P5=1
** Exponent P6 = 2**3 P6=8
+= Compounded addition P1 += 3 P1=P1+3
-= Compounded subtraction P2 -= 5 P2=P2-5
*= Compounded multiplication P3 *= 2 P3=P3*2
/= Compounded division P4 /= 9 P4=P4/9
== Equal to P1 == 4
!= Different from, other than P2 != 5
>= Greater than or equal to P3 >= 10
<= Smaller than or equal to P4 <= 7
> Greater than P5 > 5
< Smaller than P6 < 5
& Binary AND P1 = P11 & P12
| Binary OR P2 = P21 | P22
^ Exclusive OR (XOR) P3 = P31 ^ P32
INV[...] Inverse P4 = INV[P41]
* Logic AND $IF [P11 == 1] * [P12 >=5]
+ Logic OR $IF [P21 != 0] + [P22 == 8]