Siemens LOGO! Nesting Depth: Limits, Flag Recursion, 0BA6 vs 0BA8

David Krause17 min read
PLC HardwareSiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Siemens LOGO! Nesting Depth: Limits, Flag Recursion, and Generation-by-Generation Behavior

The "Nesting Depth" indicator in LOGO!Soft Comfort is one of the most-misread fields in the entire Siemens LOGO! programming environment. It is not a decorative statistic, not a memory counter, and not a warning that an error has already occurred. It is a real-time evaluation of the longest signal path your circuit program contains, expressed in objects (input + function blocks + output). On legacy hardware it is a hard compile-time limit; on modern hardware it is informational, but the underlying path-length budget still affects the way a programmer should decompose logic.

This reference reconstructs the meaning of the field, walks through the generation-by-generation history of the limit (from the original 0BA0/0BA2 caps to the relaxed 0BA6/0BA8 architecture), documents the canonical 58-object rule, and provides a field-ready flag-recursion procedure for breaking long paths. It is written for control engineers, panel builders, and integrators who need a definitive answer to the question "does this nesting depth actually mean the program will not work?"

Applies to: Siemens LOGO! 0BA0 through 0BA8 (LOGO!, LOGO! 6, LOGO! 7, LOGO! 8, LOGO! 8.3, LOGO! 8.4) with LOGO!Soft Comfort V5.x, V6.x, V7.x, V8.0, V8.1, V8.2, V8.3, and V8.4. Specific behavior varies by generation and is called out in the tables below.

1. What "Nesting Depth" Actually Means

In LOGO!Soft Comfort, every circuit diagram is internally represented as a directed graph. Each node on a path is an object:

  • Input objects — digital inputs I1..I24, analog inputs AI1..AI8, network inputs NI1..NI64, flag inputs, shift-register bits, and the high/low constant blocks.
  • Function-block objects — AND, OR, NOT, NAND, NOR, XOR, counters, timers, on/off delays, weekly/yearly timers, analog comparators, threshold switches, PI controllers, math blocks, multiplexer, shift register, edge detectors, soft keys, and similar standard FBD elements.
  • Output objects — digital outputs Q1..Q20, analog outputs AQ1..AQ8, network outputs NQ1..NQ64, and text/flag output terminals.

A program path is a connected chain of objects that begins at an input block, traverses zero or more function blocks, and terminates at an output (or at a flag, which the LOGO! kernel treats as a path terminator). The nesting depth is the length, in objects, of the longest such path in the entire circuit program.

Siemens defines the canonical 58-object maximum for the legacy generations as:

Component Object Count
Input block 1
Function blocks in path 56
Output block 1
Maximum path length 58 objects

During simulation in LOGO!Soft Comfort and during download to the device, the compiler checks every path and emits an error if any single path exceeds the maximum allowed for that generation. The "Nesting Depth" field displayed in the program-information dialog is the running maximum across the entire program.

2. Generation-by-Generation Evolution of the Limit

The nesting-depth limit is not static; it has been progressively relaxed as LOGO! firmware gained processing power and as the internal interpreter moved from a fixed-stack evaluation model to a flag-segmented model. The table below summarizes the publicly documented behavior of each generation.

Generation Order Number Prefix Max Function Blocks per Path Max Path Length (objects) Strict Compile Error?
LOGO! (0BA0) 6ED1 052-... 7 9 Yes (hard stop)
LOGO! 12/24 (0BA2) 6ED1 052-1xx 7 9 Yes
LOGO! 24/230 (0BA2) 6ED1 053-1xx 7 9 Yes
LOGO! 0BA3 6ED1 052-2xx / 6ED1 053-2xx 7 9 Yes
LOGO! 0BA4 (with KNX) 6ED1 052-3xx 7 (relaxed internally) 9 Yes (warning)
LOGO! 0BA5 6ED1 052-4xx / 6ED1 053-4xx Up to 56 58 Yes (hard stop)
LOGO! 0BA6 (LOGO! 6) 6ED1 052-6xx / 6ED1 053-6xx 56+ (practically removed) Display only Display only — see note
LOGO! 0BA7 (LOGO! 7) 6ED1 052-7xx / 6ED1 053-7xx Effectively unlimited (FBD path) Display only Display only
LOGO! 0BA8 (LOGO! 8) 6ED1 052-8xx / 6ED1 053-8xx Up to 400 function blocks per program Display only Display only
LOGO! 8.3 (0BA8.FS3) 6ED1 052-8Ax / 6ED1 053-8Ax Up to 400 function blocks per program Display only Display only
LOGO! 8.4 (0BA8.FS4) 6ED1 052-8Bx / 6ED1 053-8Bx Up to 400 function blocks per program Display only Display only
For 0BA6 and later: the legacy 58-object cap is no longer enforced as a compile error. However, the field continues to be reported as a diagnostic, and path decomposition using flags remains the recommended way to keep cycle time short, because each function block in a single path executes serially within a single LOGO! scan cycle. See Siemens LOGO! 0BA6 system manual (SIEMENS, 2009) and the LOGO! 8 (0BA8) system manual for the canonical block-count tables.

3. Why the 58-Object Rule Existed

Original LOGO! firmware (0BA0 to 0BA3) ran a token-based interpreter that walked the FBD graph depth-first during each scan. The interpreter held the current evaluation state in a fixed internal stack sized for a maximum of 7 function blocks per path plus 1 input and 1 output, yielding the 9-object / 7-block ceiling. Exceeding the stack would either truncate the path silently or, in later 0BA4 firmware, generate the error Nested blocks limit exceeded.

With 0BA5 (released in 2005), Siemens raised the hard limit to 56 blocks per path (58 objects total) to support market demand for more complex building-automation and small-process applications. The 0BA5 kernel still used a fixed-stack model, but the stack was extended.

From 0BA6 onward, Siemens moved path evaluation to a flag-segmented model: a function block whose output is wired to a flag terminates the current path in the interpreter's eyes, and any downstream block connected to the flag starts a fresh path. The legacy depth counter became a developer-information field, and the soft error became a hard warning only when the project is downloaded to an older device (0BA5 or earlier) using cross-compatibility mode.

4. Reading the Nesting-Depth Field in LOGO!Soft Comfort

In LOGO!Soft Comfort V6.x, V7.x, and V8.x the field is exposed in two places:

  1. Menu > File > Properties > Statistics tab — displays the current Maximum nesting depth as an integer object count, plus the related counters: number of function blocks, memory usage, and program name.
  2. Status bar (lower-right of the FBD editor) — live-updates as you connect blocks. The number after the Maximum nesting depth: prefix shows the deepest path constructed so far.

For a 0BA6 user running LOGO!Soft Comfort V6.x or V7.x, the value can be ignored for compilation purposes, but it remains useful for the following engineering checks:

  • Sanity-checking FBD conversions imported from older generation devices.
  • Estimating the worst-case scan-time contribution of a single path. Each additional function block on a path adds one or more PLC-internal microcycles, and the total time spent inside one scan rises linearly with the longest path.
  • Deciding whether to split a path with a flag to reduce jitter on high-speed inputs (e.g., a 1 kHz counter feeding a long chain of arithmetic blocks).

5. Implementing Longer Paths: Signal Recursion with Flag Blocks

Even on 0BA6/0BA7/0BA8, the official Siemens guidance for path decomposition uses flag blocks as path terminators. A flag is a software boolean that the LOGO! kernel evaluates as both a path output and a path input. From the compiler's point of view, a flag splits a long chain into two short ones.

5.1 Canonical procedure

  1. Identify the longest path in the FBD diagram. Use the editor's auto-routing hints, or manually count the blocks from the input to the deepest output.
  2. Choose a flag (M1, M2, ... M27 for digital flags, or AM1..AM6 for analog flags on 0BA8). Use a flag number that is not already in use elsewhere in the program.
  3. Cut the chain at the desired split point. Place the flag at the output side of the cut.
  4. Connect the upstream blocks to the flag's input pin.
  5. Connect the flag's output pin to the first downstream block in the second half of the chain.
  6. Recompile. The status bar should now show a smaller maximum nesting depth, equal to the longer of the two new sub-paths.

5.2 Worked example (0BA6, LOGO!Soft Comfort V6.x)

Consider a pump-control application with the following path:

I1 (Start) → B01 AND → B02 OR → B03 NOT → B04 NAND → B05 On-Delay → B06 Counter → B07 Threshold Switch → Q1 (Pump)

That is 1 input + 7 function blocks + 1 output = 9 objects (the legacy 0BA0/0BA2/0BA3 limit). It is fine for any generation, but imagine extending the chain with two more blocks (a PI controller and a multiplexer) for a 13-object path. Inserting a flag at the multiplexer input is the standard fix:

I1 → B01 AND → B02 OR → B03 NOT → B04 NAND → B05 On-Delay → B06 Counter → B07 Threshold Switch → M1 (Flag)

M1 → B08 PI Controller → B09 Multiplexer → Q1

The maximum nesting depth is now 9 objects (1 + 7 + 1) on the upper sub-path, and 5 objects (1 + 3 + 1) on the lower sub-path. The compiler reports 9. Both halves compile cleanly on every generation including 0BA3.

5.3 When no flags are available

On 0BA6 and 0BA7, the digital flag pool is M1..M27 (27 flags). If all flags are consumed by other functions such as shift registers, latching relays, or the special cursor-key / message text flags, Siemens documents that an output block can be used as a path terminator in the same role. Wire the chain to a real or unused physical output (or a network output NQ) and feed the output back into the downstream blocks. The drawback is that the output is also driven by the program, so this trick should only be used for outputs that are otherwise unused or that are intended to mirror the same value (a digital amplifier role).

6. Nesting Depth vs. Total Block Count

Two commonly confused limits:

  • Nesting depth = the longest single path in the program (objects).
  • Block count = the total number of function blocks placed in the program (independent of how they are wired).

The 0BA8 platform supports up to 400 function blocks per program in total (including timers, counters, analog, math, and UDFs). The legacy 58-object path limit does not constrain the total block count — it only constrains how many of those blocks can appear on any one connected chain.

Resource 0BA5 0BA6 0BA7 0BA8 / 8.3 / 8.4
Total function blocks 130 200 200 400
Remanent flags 0 0 0 Up to 64
Maximum path length (objects) 58 (hard) Display only Display only Display only
Digital outputs 4 to 16 4 to 20 4 to 20 4 to 20
User program memory 2 KB blocks 4 KB blocks 4 KB blocks 8500 bytes (4 KB program + 4 KB data + data log)

For 0BA8 deployment, see the official LOGO! 8 (0BA8 Standard) System Manual (SIEMENS, edition 2014-2019) and the latest LOGO!Soft Comfort V8.4 Online Help & Programming Manual for the canonical block budgets.

7. Generation-Specific Behavior for 0BA6 Users

The original question came from a user with 6ED1 ... 0BA6 hardware and LOGO!Soft Comfort V6.x. For that specific combination, the practical answer is:

  • The "Nesting Depth" field can be ignored for compile purposes — the 0BA6 kernel does not enforce a hard path-length cap on a freshly authored program.
  • The field can still produce a soft warning when the program is downloaded to the device, because the LOGO!Soft Comfort compiler cross-checks against the lowest-generation device in the project's compatibility list.
  • When porting an old 0BA3 or 0BA4 program forward to 0BA6, the field can be used as a sanity check that the new flag-and-output structure is shorter than the original 9-object cap. If the new program exceeds 9 objects on a path, the user has not actually gained anything; the program may run on 0BA6 but will fail to run on 0BA5 or earlier if the project is ever ported back.
  • The Maximum nesting depth: indicator may be followed by a tag reference such as (I1), (Q1), or a block name. That suffix indicates the terminal object at which the deepest path ends, which is the suggested place to insert a flag for path decomposition.
0BA6 firmware is the oldest generation still supported by LOGO!Soft Comfort V8.x via the device-selection dropdown. To program a 0BA6, select the LOGO! 0BA6 device family before editing. If you author a program against the default LOGO! 8.4 device and try to download to a 0BA6, the compiler will silently truncate unsupported blocks and may inflate the reported nesting depth because the truncated path is no longer optimizable.

8. Scan-Time Impact of Long Paths

Although the path-length limit has been relaxed, the cycle time of a LOGO! grows roughly linearly with the depth of the longest path, because each block is evaluated sequentially. For a 0BA8 with firmware version FS4 (V1.83.x) or later, a typical block evaluation time is 0.5 to 4 microseconds per block, depending on the block type. A 58-object path of mixed analog, math, and timer blocks can therefore add up to 0.25 ms to the scan time.

Field-proven rule of thumb from Siemens application notes: keep the deepest path below 30 objects to stay under 0.1 ms scan-time contribution. For 1 kHz high-speed counter applications on 0BA8 (using the integrated I1/I2 high-speed inputs up to 5 kHz), the recommended path length is < 15 objects.

Sources for the timing figures: LOGO! 8 (0BA8) System Manual, section 4.4 "Cycle time" and the LOGO! 0BA8 Technical Data FAQ (SIEMENS, 2017).

9. Error Messages and Diagnostic Workflows

When the path-length cap is exceeded, the compiler emits one of the following messages. The exact wording depends on the LOGO!Soft Comfort version, but the codes are stable.

Error / Warning Generation Meaning Action
Nested blocks limit exceeded 0BA0..0BA3 A path has more than 7 function blocks Split with a flag (M-flag) or output
Maximum nesting depth of 58 objects exceeded 0BA5 A path has more than 56 function blocks + 1 input + 1 output Split with a flag
Warning: nesting depth approaches limit 0BA5 cross-compat from 0BA6 Path length is large; portability risk Decide to keep the path or split
Information: maximum nesting depth = N 0BA6..0BA8 Diagnostic only None (or split to reduce scan time)
Block cannot be placed: unsupported on this device 0BA6..0BA8 mismatch Block is generation-specific Replace with generation-equivalent block

To locate the offending path, use Menu > Edit > Search → Reference on the deepest input or output, then use Menu > Tools > Highlight Path (LOGO!Soft Comfort V8.x) to see the chain highlighted in the FBD canvas.

10. Commissioning Checklist for Programs with Deep Paths

  1. Open the project in LOGO!Soft Comfort V8.x and confirm the target device is correctly selected (e.g., LOGO! 8.3 (0BA8.FS3) or LOGO! 0BA6).
  2. Open File > Properties > Statistics and record the Maximum nesting depth and the Function blocks total.
  3. If the nesting depth exceeds 30 objects, decompose the path with one or more flag blocks. Re-check the depth after each split.
  4. Run an offline simulation (F5 in LOGO!Soft Comfort). Watch the FBD canvas for unintended signal propagation across flag boundaries, because the flag introduces a one-scan-cycle delay.
  5. Download to the device (PC → LOGO! toolbar). Confirm the green Online indicator appears and the program version matches the latest .lsc file in your archive.
  6. Trigger each input edge manually and verify the deepest output transitions within the expected scan window (use the integrated Data Log feature on 0BA8 with a microSD card for sub-millisecond resolution).
  7. Document the flag numbers used in the program header so that future modifications do not accidentally consume a flag that the path-decomposition pattern depends on.

11. Troubleshooting Matrix

Symptom Generation Likely Root Cause Fix
Compiler refuses download, error 1006 / "nested blocks" 0BA3 or earlier Path has > 7 blocks Insert flag at the 7th block; use M-flags M1..M27
Compiler reports warning 2001, downloads successfully 0BA6/0BA7 Path exceeds legacy 58-object reference Optional: split for scan-time hygiene
Output does not transition as expected 0BA5+ Flag was inserted in the wrong direction Verify flag input pin is on the upstream side, output pin drives downstream
Counter resets every 10 minutes unexpectedly 0BA6/0BA7 Count path is wrapped through an output block as a flag Convert to a true flag; outputs toggle the coil and corrupt the count
Program downloads but does not run on 0BA8 0BA8 Block budget (400) exceeded or path broken by UDF boundaries Reduce block count or inline the UDF
Deepest path indicator shows 1 after disconnecting the deepest output Any Indicator is dynamic and updates after re-route Reconnect, re-check after a full recompile
Indicator shows 0 in the status bar 0BA6/0BA7 with empty FBD No paths are connected Add at least one input and one output to populate the diagram

12. Field-Proven Patterns and Edge Cases

12.1 Analog chains

Analog blocks (math, PI controller, analog comparator, threshold switch) typically take 2-3 microcycles to evaluate on 0BA8. A chain of 6 analog blocks therefore adds 12-18 microseconds to the scan, well below the 0.25 ms budget. However, when the analog signal is also being routed through a multiplexer and then to two separate outputs, the path length is doubled on the multiplexer pin and the nesting depth can spike. Inserting an analog flag (AM1..AM6) at the multiplexer output is the recommended decomposition.

12.2 Mixing UDFs and standard blocks

User-Defined Functions (UDFs) on 0BA7 and later behave as a single block from the path-counting perspective. The internal nesting depth of the UDF is reported as a separate sub-statistic; the parent diagram only counts the UDF block as one object. This means a deeply nested UDF will not blow the main nesting-depth budget, but it can still create internal scan-time problems that are not visible at the top level.

12.3 Network inputs and outputs

Network inputs NI1..NI64 and network outputs NQ1..NQ64 count as standard input and output objects for path-length purposes. A long path that originates at a local input, travels through 30 local blocks, and then propagates to a network output NI before re-entering the diagram via a network input NI1 to drive another 25 blocks is still a single 57-object path from the compiler's view — the network boundary does not split the path. This is a common mistake when porting programs that use the LOGO! 8 Ethernet peer-to-peer feature. Insert a flag at the network output to break the path into two halves.

12.4 Cross-generation portability

If the program is ever required to run on a 0BA5 in a service-spare scenario, the safest authoring practice is to keep every path at or below the 58-object cap. Path decomposition with flags is the standard solution, and because flags are generation-agnostic, the decomposition is portable.

13. Summary of Practical Rules

  • 0BA3 and earlier: the 7-blocks-per-path cap is a hard limit; insert a flag at the 7th function block.
  • 0BA5: the 56-blocks / 58-objects cap is a hard limit; insert a flag when the path approaches 30 blocks for scan-time reasons.
  • 0BA6 and later: the cap is informational; use the indicator as a scan-time and code-quality metric.
  • All generations: flag blocks (M1..M27 on 0BA6/7, M1..M64 plus AM1..AM6 on 0BA8) are the canonical way to break long paths.
  • Output blocks are a last-resort alternative to flags when the flag pool is exhausted.
  • Network I/O does not split a path — explicit flag insertion is required for clean decomposition.

What does the "Maximum nesting depth" indicator in LOGO!Soft Comfort show?

It shows the longest connected chain of objects (input + function blocks + output) in your circuit program, expressed as a count. On 0BA5 and earlier, exceeding the per-generation cap is a compile error. On 0BA6 and later, the value is informational but still useful for scan-time budgeting.

Does a high nesting depth on my 0BA6 mean the program will not work?

No. The 0BA6 kernel does not enforce a hard path-length cap on a freshly authored program, and the indicator is only a soft warning. However, paths above 30 objects can add measurable scan time and should be split with flag blocks for code hygiene.

How do I break a long path into two shorter paths?

Place a flag block (M1..M27 on 0BA6/0BA7, M1..M64 plus AM1..AM6 on 0BA8) at the desired split point, connect the upstream blocks to the flag's input pin, and wire the flag's output to the first downstream block. LOGO! treats the flag as both a path output and a path input, so the longest path is now the longer of the two sub-paths.

Can I use an output block instead of a flag to split a long path?

Yes. On 0BA6/0BA7, when all 27 digital flags (M1..M27) are in use, an unused digital output Qx or network output NQx can be wired as the path terminator and fed back into the downstream blocks. The drawback is that the output is also driven by the program, so use this trick only for outputs that mirror the same value.

Is the nesting-depth limit the same as the total function-block count limit?

No. The nesting-depth limit applies to a single connected chain, while the total function-block count is the sum of all blocks in the program. On 0BA8, the total block budget is 400; the path-length limit is informational and reported by the same dialog. Path decomposition with flags does not reduce the total block count, only the longest chain length.

Where can I find the official path-length and block-count tables for my LOGO! generation?

See the system manual for your device on the Siemens Industry Online Support portal: LOGO! 0BA6 system manual, LOGO! 8 (0BA8) system manual, and the LOGO!Soft Comfort V8.4 programming manual. Cross-reference the table in section 2 above to identify the cap that applies to your hardware.

Back to blog