Basic instructions
7.1 Bit logic operations
FBD AND, OR, and XOR boxes
In FBD programming, LAD contact networks are transformed into AND (&), OR (>=1), and
exclusive OR (x) box networks where you can specify bit values for the box inputs and
outputs. You may also connect to other logic boxes and create your own logic combinations.
After the box is placed in your network, you can drag the "Insert input" tool from the
"Favorites" toolbar or instruction tree and then drop it onto the input side of the box to add
more inputs. You can also right-click on the box input connector and select "Insert input".
Box inputs and outputs can be connected to another logic box, or you can enter a bit
address or bit symbol name for an unconnected input. When the box instruction is executed,
the current input states are applied to the binary box logic and, if true, the box output will be
true.
Table 7- 3
AND, OR, and XOR boxes
FBD
For SCL: You must assign the result of the operation to a variable to be used for another statement.
1
Table 7- 4
Data types for the parameters
Parameter
IN1, IN2
204
SCL
1
out := in1 AND
in2;
out := in1 OR in2;
out := in1 XOR
in2;
Data type
Bool
Description
All inputs of an AND box must be TRUE for the output to be
TRUE.
Any input of an OR box must be TRUE for the output to be
TRUE.
An odd number of the inputs of an XOR box must be TRUE for
the output to be TRUE.
Description
Input bit
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG