PLCcheck

S5 AWL Commands: Comparison Operations (!=F, ><F, >F, <F)

S5 AWL comparison instructions: !=F (equal), ><F (not equal), >F (greater), <F (less). Compare ACCU2 with ACCU1, result in VKE.

·4 min read
S5AWLcomparisonequalgreaterlessINTVergleich

Diesen Artikel auf Deutsch lesen

S5 AWL Commands: Comparison Operations

S5 comparisons operate on ACCU2 and ACCU1. The result is written to the VKE (TRUE if condition met, FALSE otherwise). Use with SPB/SPBN for conditional branching.

Instructions

S5 AWLConditionS7 STLS7 SCL
!=FACCU2 = ACCU1==IIF a = b
><FACCU2 ≠ ACCU1<>IIF a <> b
>FACCU2 > ACCU1>IIF a > b
<FACCU2 < ACCU1<IIF a < b
>=FACCU2 ≥ ACCU1>=IIF a >= b
<=FACCU2 ≤ ACCU1<=IIF a <= b

Data type: All F-suffix comparisons operate on INT (16-bit signed). For DINT (32-bit), use G-suffix: !=G, ><G, >G, <G.

Code Example — Compare and Branch

L   MW 10           // Load setpoint (→ ACCU2 after next L)
L   MW 20           // Load actual value (→ ACCU1)
>F                  // Is MW10 > MW20?
SPB =M001           // If yes, jump to M001
// ... MW10 ≤ MW20 code ...
SPA =M002
M001: // ... MW10 > MW20 code ...
M002: NOP 0

SCL equivalent: IF MW10 > MW20 THEN ... ELSE ... END_IF;

Important: Comparison Order

Comparisons check ACCU2 vs. ACCU1: the first loaded value is compared against the second. L MW10 / L MW20 / >F tests "MW10 > MW20".

All Comparison Variants

INT (16-bit)DINT (32-bit)REAL (32-bit float)
!=F!=G!=F (with REAL in ACCU)
><F><G
>F>G
<F<G
>=F>=G
<=F<=G

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.