PLCcheck

S5 AWL Commands: BE, BEA, BEB (Block End)

S5 AWL instructions BE (Block End), BEA (Block End Absolute), BEB (Block End Conditional). Three ways to end a block in S5 AWL.

·3 min read
S5AWLBEBEABEBblock endBausteinendereturn

Diesen Artikel auf Deutsch lesen

S5 AWL Commands: BE, BEA, BEB (Block End)

S5 AWL uses three block-end instructions. Every block must end with BE (or BEA). BEB provides conditional block exit.

BE — Block End (Bausteinende)

The standard block-end instruction. Mandatory at the end of every S5 block (OB, FB, FC, DB).

U  E 0.0
=  A 4.0
BE              // End of block — return to calling block

S7 equivalent: BE is automatic in S7 TIA Portal — you do not write it explicitly. In S7 STL, BE still exists but is optional.

BEA — Block End Absolute (Bausteinende absolut)

Identical to BE. Returns to the calling block unconditionally. In practice, BEA and BE are interchangeable in most S5 CPUs. BEA is sometimes used to emphasize "this is a definitive end."

BEA             // Same as BE in most CPUs

BEB — Block End Conditional (Bausteinende bedingt)

Ends the block only if VKE is TRUE. If VKE is FALSE, execution continues with the next instruction. Used for "early exit" patterns.

U   E 0.5          // Check condition
BEB                 // If TRUE → exit block immediately
// ... code below only runs if E 0.5 is FALSE ...
BE

S7 equivalent: IF condition THEN RETURN; END_IF; in SCL.

Common Error

Forgetting BE at the end of a block: Without BE, the CPU may execute random memory as instructions, causing unpredictable behavior or a CPU STOP.


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.