Mitsubishi Electronics Q173HCPU/Q172HCPU Work Light User Manual


 
6 - 143
6 MOTION PROGRAMS FOR POSITIONING CONTROL
6.16.10 Logical operators (AND, OR, XOR, NOT, <<, >>)
Code
AND, OR, XOR, NOT,
<<, >>
Function Logical operators
Logical product (AND), logical add (OR), exclusive logical add (XOR),
logical NOT (NOT) and shift operations (<<, >>) are executed.
Format
<For AND, OR, XOR, <<, >>>
Numerical value or variable
n1
Logical operator (AND, OR, XOR, <<, >>)
Numerical value or variable
logical operator
n2 ;
<For NOT>
O
Numerical value or variable
N[]nT;1
[Explanation]
(1) Operation of the specified logical operator is executed.
(2) Only the integer types (16-bit type, 32-bit type) may be used to perform logical
operation. Logical operation including the 64-bit floating-point type cannot be
performed. (error 560 : Format error)
The operation result can be 16- or 32-bit type, but it is converted into the operation
result type for operation.
(3) The area of operation where you want to give priority can be enclosed in [ ]. [ ]
can be five levels deep including [ ] of a function. An operational expression may
be described in up to 72 characters. (Up to the maximum number of characters in
one block)
<For AND, OR, XOR, <<, >> >
Operation result = operation data 1 operator operation data 2 ;
Operation result
is stored
Operation is performed after conversion of operation data
1, 2 into operation result type.
Note that operation including 64-bit floating-point type cannot be performed.
<For NOT>
Operation result = NOT [operation data 1] ;
Each bit of operation data 1 is inverted and result
of inversion is stored into operation result.
(4) The logical operators can be used with the conditional expressions of the IF and
WHILE statements.
IF [ [ON #M1000] AND [OFF #M1100] ] GOTO1 ;
If M1000 is ON and M1100 is OFF, the N1 line is executed.
IF [ [#2100 AND #2200] EQ #2300] GOTO2 ;
If the result of operating AND #2100 and #2200 contents is equal to #2300, the
N2 line is executed.