S5 AWL Command: SPB (Conditional Jump)
S5 AWL instruction SPB: Jump to label if VKE is TRUE. The primary conditional branching instruction — equivalent to IF in high-level languages.
S5 AWL Command: SPB (Conditional Jump if TRUE)
SPB jumps to a label only if the VKE is TRUE. If VKE is FALSE, execution continues with the next instruction. SPB is the primary conditional branching mechanism in AWL — it implements IF/THEN logic.
Syntax
U E 0.0 // Condition
SPB =M001 // Jump to M001 if E 0.0 is TRUE
S7 Equivalent
| S5 AWL | S7 STL | S7 SCL |
|---|---|---|
SPB =M001 | JC M001 (EN) / SPB M001 (DE) | IF condition THEN ... |
Code Example — IF/THEN
U E 0.0 // IF E 0.0
SPB =M001 // THEN jump to M001
SPA =M002 // ELSE jump to M002 (skip THEN block)
M001: L KF +100 // THEN: load 100
T MW 20
SPA =M099 // Jump to end
M002: L KF +0 // ELSE: load 0
T MW 20
M099: NOP 0 // Continue
SCL equivalent: IF E0_0 THEN MW20 := 100; ELSE MW20 := 0; END_IF;
VKE After SPB
- If jump is taken (VKE was TRUE): VKE is set to 1 at the target label
- If jump is not taken (VKE was FALSE): VKE remains 0, execution continues
Common Patterns
| Pattern | AWL | SCL Equivalent |
|---|---|---|
| IF/THEN | SPB =Mxxx | IF cond THEN ... END_IF |
| IF/THEN/ELSE | SPB =Mthen / SPA =Melse | IF cond THEN ... ELSE ... END_IF |
| CASE (multi-branch) | Multiple L/==F/SPB | CASE var OF ... END_CASE |
Related: SPA (Unconditional) | SPBN (Jump if NOT)
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
Reading 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
migration-guideS5 to S7 Migration: The Complete Guide (2026)
Step-by-step guide for migrating Siemens S5 PLC programs to S7-1500. Covers AWL→SCL conversion, timer mapping, address translation, and hardware selection.
18 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.