PLCcheck

S5 AWL Command: O (OR)

S5 AWL instruction O (OR): Syntax, S7 equivalent, code examples. OR bit logic operation for the VKE.

·3 min read
S5AWLOORODERbit logic

Diesen Artikel auf Deutsch lesen

S5 AWL Command: O (OR)

The O instruction performs a logical OR operation on the VKE. It reads a boolean operand and ORs it with the current VKE.

Syntax

O  <operand>

S7 Equivalent

S5 AWLS7 STLS7 SCL
O E 0.1O I 0.1 (EN) / O E 0.1 (DE)... OR Input_0_1

In S7, O remains O in both English and German mnemonics.

Code Example

Two start buttons (either one starts the motor):

O  E 0.0       // Start button 1
O  E 0.1       // Start button 2
=  A 4.0       // Motor on

AND before OR (implicit precedence in AWL):

U  E 0.0       // Condition A1
U  E 0.1       // Condition A2
O                // OR (starts new AND branch)
U  E 0.2       // Condition B1
U  E 0.3       // Condition B2
=  A 4.0       // Result: (A1 AND A2) OR (B1 AND B2)

Important: The standalone O (without operand) acts as an OR separator between AND chains. This is one of the most misunderstood AWL features.

Common Errors

Forgetting operator precedence: In AWL, AND (U) binds tighter than OR (O). The expression U E0.0 / O E0.1 / U E0.2 means E0.0 OR (E0.1 AND E0.2), NOT (E0.0 OR E0.1) AND E0.2. Use parentheses U( / ) or the standalone O to control precedence.


Part of the S5 AWL Command Reference. Maintained by PLCcheck.ai.


Analyze Your S5 Code Automatically

PLCcheck Pro reads your complete S5 AWL program and explains every instruction — including this one — in plain language. Upload your code and get instant documentation, S7 equivalents, and migration guidance.

Upload S5 code for free analysis → | S5→S7 Migration Guide →

Related Articles

Analyze your PLC code with AI

PLCcheck Pro explains, documents, optimizes, and migrates PLC code — automatically.

Try PLCcheck Pro →
← Back to Blog

Not affiliated with Siemens AG. S5, S7, STEP 5, STEP 7, and TIA Portal are trademarks of Siemens AG.