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.
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 AWL | Condition | S7 STL | S7 SCL |
|---|---|---|---|
| !=F | ACCU2 = ACCU1 | ==I | IF a = b |
| ><F | ACCU2 ≠ ACCU1 | <>I | IF a <> b |
| >F | ACCU2 > ACCU1 | >I | IF a > b |
| <F | ACCU2 < ACCU1 | <I | IF a < b |
| >=F | ACCU2 ≥ ACCU1 | >=I | IF a >= b |
| <=F | ACCU2 ≤ ACCU1 | <=I | IF 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
Legacy PLC Emulators vs. Full Migration: Pros and Cons
Comparison of PLC emulator/adapter solutions vs. full program migration. When emulation makes sense as a bridge, and why it is not a long-term solution.
8 min read
plc-documentationReading and Understanding S5 AWL Code: A Practical Guide
Learn to read Siemens S5 AWL (Instruction List) code from scratch. Covers the accumulator model, bit logic, load/transfer, timers, counters, jumps, and data blocks with real code examples and line-by-line explanations.
16 min read
migration-guideThe Siemens S5/S7 Converter Tool: What It Does and What It Doesn't
Honest assessment of the Siemens STEP 7 S5→S7 conversion tool. What it converts automatically, what it cannot handle, common errors, and how to deal with the remaining 20–40% that requires manual work.
12 min read
Analyze your PLC code with AI
PLCcheck Pro explains, documents, optimizes, and migrates PLC code — automatically.
Try PLCcheck Pro →Not affiliated with Siemens AG. S5, S7, STEP 5, STEP 7, and TIA Portal are trademarks of Siemens AG.