5bitwise operators, 6boolean operators, Bitwise operators – Lenze PMSS1000 Simple Servo User Manual
Page 29: Boolean operators, 5 bitwise operators, 6 boolean operators
Indexer-Programmer-Manual.pdf REV 1.3
2.5 Bitwise
operators
The following bitwise operators are supported
Operator Symbol
AND
&
OR
|
XOR
^
NOT
!
Both User or System variables can be used with these operators.
Examples:
V1 = V2 & 0xF
;clear all bits but lowest 4
IF (INPUTS & 0x3)
;check inputs 0 and 1
V1 = V1 | 0xff
;set lowest 8 bits
V1 = INPUTS ^ 0xF ;invert inputs 0-3
V1 = !IN_A1 ;invert input 0
2.6 Boolean
Operators
These operators are used in logical expressions.
Operator Symbol
AND
&&
OR
||
NOT
!
Examples:
IF APOS >2 && APOS <6 || APOS >10 && APOS <20
. {statements if true}
ENDIF
Above example check if APOS(actual position) within one of two windows:
2 to 6 units or 10 to 20 units. In plain English:
"If APOS more then 2 AND APOS less then 6 OR APOS more then 10 AND APOS
less then 20 -----à then evaluate to TRUE. Otherwise it is FALSE"
29