Download Pro-Control Editor 4.0 User Manual - Pro

Transcript
Chapter 4 – Instructions
4.2.10
OR (Or)
When the OR instruction is executed, the bit in C turns ON if the corresponding bit in A
and/or B is ON. Otherwise, the bit in C is turned OFF.
A
Operator
ON
ON
OFF
OR
OFF
B
C
ON
ON
OFF ON
ON
Integer A
0
1
1
0
...
1
1
0
0
Integer B
1
1
0
0
...
0
0
0
1
Integer C
1
1
0
0
...
1
1
0
1
ON
OFF OFF
There are three types of OR instruction:
1. When both A and B are Integer variables, a simple 32-bit OR operation is
performed.
2. When A and C are arrays and B is not in an Integer array, an OR operation is
carried out for each element of A and B. The result of each calculation is stored in
the corresponding element in C. Both A and C arrays must be the same size.
3. When all three variables have arrays that are the same size, an OR operation is
performed on array A and array B. The results are stored in array C.
The OR instruction always passes power.
The OR instruction can be performed with the following combinations of variable types.
4–14
A
B
C
Integer
Integer Array
Integer
Integer Array
Integer
Integer Array
Integer Constant
Integer Constant
Integer
Integer Array
Integer
Integer Array
Pro-Control Ver. 4.0 User Manual