Program instructions
7.11 Logical operations
S7-200 SMART
336
System Manual, V2.3, 07/2017, A5E03822230-AF
7.11.2
AND, OR, and exclusive OR
LAD / FBD
STL
Description
WAND_W
WAND_DW
ANDB IN1,
OUT
ANDW IN1,
OUT
ANDD IN1,
OUT
The AND Byte, AND Word, and AND Double Word instructions logically AND the corre-
sponding bits of two input values IN1 and IN2 and load the result in a memory location
assigned to OUT.
•
LAD and FBD: IN1 AND IN2 = OUT
•
STL: IN1 AND OUT = OUT
WOR_W
WOR_DW
ORB IN1,
OUT
ORW IN1,
OUT
ORD IN1,
OUT
The OR Byte, OR Word, and OR Double Word instructions logically OR the correspond-
ing bits of two input values IN1 and IN2 and load the result in a memory location as-
signed to OUT.
•
LAD and FBD: IN1 OR IN2 = OUT
•
STL: IN1 OR OUT = OUT
WXOR_W
WXOR_DW
XORB IN1,
OUT
XORW IN1,
OUT
XORD IN1,
OUT
The Exclusive OR Byte, Exclusive OR Word, and Exclusive OR Double Word instruc-
tions logically XOR the corresponding bits of two input values IN1 and IN2 and load the
result in a memory location OUT.
•
LAD and FBD: IN1 XOR IN2 = OUT
•
STL: IN1 XOR OUT = OUT
Non-fatal errors with ENO = 0 SM bits affected
•
0006H Indirect address
•
SM1.0 Result of operation = zero
Input / output
Data type
Operand
IN1, IN2
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
WORD
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Constant
DWORD
ID, QD, VD, MD, SMD, SD, LD, AC, HC, *VD, *LD, *AC, Constant
OUT
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *AC, *LD
WORD
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, *VD, *AC, *LD