Schneider Electric 372 SPU 780 01EMAN Welding System User Manual


 
Using the Logic Editor
372 SPU 780 01EMAN May 2002 159
Bitwise operators
Bitwise operators work on binary
(base 2) representations of values.
In the case of AND, OR and XOR,
the computer applies the operator
to each digit in the two values: 010
XOR 011 (2 XOR 3 in decimal
numbers) results in 001 (1 in
decimal).
In the case of shifting operators,
the computer shifts all digits in the
binary representation of the
number the given number of
places to the left or right. Digits on
one side of the number are lost,
and zeros fill in the blanks on the
other side. For example, for 8-bit
numbers, 77 << 2 means
01001101 shifted left two digits.
The binary result is 00110100, or
52 decimal.
& AND. The single bit result of an AND
operation is only true (1) if both bits are
set to 1.
| OR. The single bit result of an OR
operation is true (1) if either bit is set to
1. The result is false (0) only if both bits
are set to 0.
^ XOR. Short for "Exclusive OR". The
single bit result of an XOR operation is
false (0) if both bits are the same, true
(1) otherwise.
<< Left Shift. The result of 40001<<#2 is
the binary representation of the
number stored at 40001 shifted left two
(#2) places. Zeros are added on the
right to fill in the gap.
>> Right Shift. The result of 40001>>#2 is
the binary representation of the
number stored at 40001 shifted right
two (#2) places. Zeros are added on
the left to fill in the gap.
Relational operators
These operators describe a
comparison between two values or
expressions. The result is always true
(1) or false (0). For example, #35 <=
#42 evaluates to 1 (true). Relational
operators are used in Conditional
expressions.
< Less than.
<= Less than or equal to.
= Equal to.
<> Not equal.
=> Greater than or equal to.
> Greater than.
Conditional operators
See below for details.
?: Used in conditional expression.
Parentheses
Used to set precedence in solving
equations. To make sure certain
operations are solved before others,
enclose those operations in
parentheses.
()
Type Operator Result