PLCcheck

S5 AWL Command: UN (AND NOT)

S5 AWL instruction UN (AND NOT): Syntax, S7 equivalent, code examples. Negated AND operation for the VKE.

·2 min read
S5AWLUNAND NOTUND NICHTbit logicnegation

Diesen Artikel auf Deutsch lesen

S5 AWL Command: UN (AND NOT)

The UN instruction performs a logical AND NOT operation. It reads a boolean operand, negates it, and ANDs the result with the current VKE.

Syntax

UN  <operand>

S7 Equivalent

S5 AWLS7 STLS7 SCL
UN E 0.2AN I 0.2 (EN) / UN E 0.2 (DE)... AND NOT NotAus

Code Example

Emergency stop circuit (active-high, NC contact):

U   E 0.0      // Start button
UN  E 0.2      // NOT emergency stop (E 0.2 = TRUE means E-Stop pressed)
=   A 4.0      // Motor on

A 4.0 is TRUE when E 0.0 is TRUE and E 0.2 is FALSE (emergency stop not pressed).

Common Pattern: Self-Holding Circuit with E-Stop

U   E 0.0      // Start
O   A 4.0      // Self-hold
UN  E 0.2      // E-Stop
=   A 4.0      // Motor

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.