Overview
This technical reference implements a sequential lighting control application on a Siemens LOGO! logic module (6ED1052 series, firmware FS04 or later) programmed with LOGO! Soft Comfort V8.x. The specification mirrors a common industrial HMI / control-panel requirement:
- Five indicator lamps H1..H5 illuminate one after the other.
- The interval between adjacent lamps is 2.0 s.
- Switch S_FWD drives the sequence in the forward direction (H1 → H2 → H3 → H4 → H5).
- Switch S_REV drives the sequence in the reverse direction (H5 → H4 → H3 → H2 → H1).
- Each lamp, once lit, must extinguish automatically 10 s after it was turned on — independent of the rest of the sequence.
Three viable implementation strategies are presented below: a cascaded timer network, a shift-register driven network, and a User Defined Function (UDF) approach. The UDF method is the recommended path because it keeps the calling program short, encapsulates the per-stage logic, and lets the same block drive both directions.
Prerequisites
| Item | Specification / Notes |
|---|---|
| Controller | Siemens LOGO! 8 (e.g. 6ED1052-1MD08-0BA2 base module, 8DI/4DO, FS04+) |
| Software | LOGO! Soft Comfort V8.2 or newer (V8.3 recommended) |
| License | Standard (UDF, shift register, asynchronous pulse generator are all included) |
| Inputs | I1 = S_FWD (N.O. pushbutton), I2 = S_REV (N.O. pushbutton), I3 = Master enable (optional) |
| Outputs | Q1..Q5 = H1..H5 (24 V indicator lamps, max 0.3 A continuous per output on a LOGO! relay DO; derate to 2 A when Q1/Q2 are solid-state transistor outputs) |
| Knowledge | FBD editor, block numbering, UDF library concept, shift-register behaviour |
Functional Specification in I/O Terms
Before opening the editor, freeze the I/O contract. A clear table avoids wiring mistakes on the bench.
| Symbol | Tag | Type | Direction | Source / Sink |
|---|---|---|---|---|
| S_FWD | I1 | Digital 24 V | Input | N.O. pushbutton, returns to I1 |
| S_REV | I2 | Digital 24 V | Input | N.O. pushbutton, returns to I2 |
| EN | I3 | Digital 24 V | Input | Master enable / run latch |
| H1 | Q1 | Relay 230 V / 24 V | Output | Lamp 1 |
| H2 | Q2 | Relay 230 V / 24 V | Output | Lamp 2 |
| H3 | Q3 | Relay 230 V / 24 V | Output | Lamp 3 |
| H4 | Q4 | Relay 230 V / 24 V | Output | Lamp 4 |
| H5 | Q5 | Relay 230 V / 24 V | Output | Lamp 5 |
Strategy 1 — Cascaded On-Delay Timers
The classic technique. A clock pulse (2.0 s) drives the input of stage 1; each stage's output feeds the next stage and simultaneously latches its own output through a parallel OR. Five on-delay blocks (T1..T5) produce the staircase.
Block List (FBD, in program order)
- B001 — Asynchronous pulse generator: TH = 2.0 s, TL = 0.0 s, parameter "Pulse" mode. Output = M1 (clock).
- B002 — AND: inputs M1 + EN, output M2.
- B003 — On-delay (rising edge): Ta = 2.0 s, trigger = M2, output = M3 (stage 1 latched).
- B004 — OR: inputs M3 + (Q1 feedback), output M4.
- B005 — On-delay: Ta = 2.0 s, trigger = M4, output M5 (stage 2).
- Repeat the OR/On-delay pair for stages 3..5.
- Five Off-delay blocks (B020..B024), Ta = 10.0 s, trigger = M3..M_final, output = Q1..Q5.
The structure produces 5 rungs and is the fastest to commission by hand, but it does not scale: ten stages cost ten more rungs and the diagram becomes unreadable. This is the "mess" the original poster was trying to escape.
Strategy 2 — Shift Register Driven
LOGO! 8 exposes a true shift register block (B008 in Soft Comfort, "Shift register"). A single 1 Hz clock generator (or the 2 s asynchronous pulse generator from Strategy 1) clocks a 1-bit shift register of length 5. The lowest-order bit becomes H1, the highest-order bit becomes H5.
Parameter Settings
| Parameter | Value | Meaning |
|---|---|---|
| Shift register block — Data input IN | I1 (FWD) XOR I2 (REV), or two separate registers | Source of the "1" to be shifted in |
| Shift register block — CLK | M1 (2.0 s pulse) | Shift on rising edge |
| Shift register block — RST | EN & NOT (FWD OR REV) | Reset on enable-off |
| Bit 1 (Q1) | SHR.1 | H1 |
| Bit 2 (Q2) | SHR.2 | H2 |
| Bit 3 (Q3) | SHR.3 | H3 |
| Bit 4 (Q4) | SHR.4 | H4 |
| Bit 5 (Q5) | SHR.5 | H5 |
Reverse direction is implemented by reading the bits in reverse order and re-mapping them to Q1..Q5, or by pre-loading the shift register with a 1 in bit 5 and shifting left on the same clock. A separate shift register must be instantiated; LOGO! Soft Comfort does not let you read a single SHR backwards in a single block.
Strategy 3 — User Defined Function (Recommended)
The UDF (User Defined Function) is a LOGO! Soft Comfort V8 feature that lets the engineer package a sub-diagram with named inputs and outputs. The UDF compiles into a single block on the calling program. The same UDF can be called five times — one for each stage — with different parameter values. Both forward and reverse sequences are obtained by changing the wiring of the UDF inputs, not the UDF body.
3.1 UDF Inputs and Outputs
| Pin | Name | Type | Description |
|---|---|---|---|
| UDF_IN1 | STAGE_EN | Bool | High to start this stage's 2 s on-delay |
| UDF_IN2 | MASTER_EN | Bool | Global enable / reset |
| UDF_IN3 | DIR | Bool | 0 = forward order, 1 = reverse order (selects whether stage N enables stage N+1 or stage N-1) |
| UDF_IN4 | LINK_IN | Bool | Output of previous (or next, in reverse) stage |
| UDF_OUT1 | LAMP | Bool | Drive Q output — lamp on/off after 10 s off-delay |
| UDF_OUT2 | LINK_OUT | Bool | Pass to LINK_IN of the next stage in the chain |
LOGO! Soft Comfort allows up to 8 inputs and 4 outputs per UDF, so the 4/2 split above is within limits.
3.2 UDF Internal Diagram
- B101 — On-delay (rising edge), Ta = 2.0 s. Input = STAGE_EN. Output = M_ON.
- B102 — Off-delay, Ta = 10.0 s. Input = M_ON. Output = LAMP (UDF_OUT1).
- B103 — SR flip-flop. S = M_ON. R = (NOT MASTER_EN) OR (NOT M_ON held 10 s after enable off). Q = M_LINK.
- B104 — 2-to-1 MUX (or simply an AND with DIR: LINK_OUT = (NOT DIR AND M_LINK AND LINK_IN) OR (DIR AND M_LINK). This routes the chain in the chosen direction.
The body is roughly 12 blocks. After compilation, the calling program sees a single block with 4 pins on the left and 2 on the right. Five instances consume the same on-board resources as five free-standing networks but read as a single rung each.
3.3 Calling Network (FBD, top-level)
+------+ +------+ +------+ +------+ +------+
| UDF1 |--->| UDF2 |--->| UDF3 |--->| UDF4 |--->| UDF5 |
+------+ +------+ +------+ +------+ +------+
| | | | | | | | | |
Q Q Q Q Q Q Q Q Q Q
| | | | | | | | | |
H1 LINK H2 LINK H3 LINK H4 LINK H5 LINK
| | | | |
+-->Q1 +-->Q2 +-->Q3 +-->Q4 +-->Q5
For reverse order, wire LINK_OUT of UDF5 into LINK_IN of UDF4, etc.
DIR pin on all UDFs = I1 (FWD) // 0 for FWD, 1 for REV
Reverse Direction (H5 → H1)
Two robust methods are used in production:
| Method | Implementation | Trade-off |
|---|---|---|
| Symmetric chain | Instantiate a second chain of 5 UDFs whose LINK wires run UDF5r → UDF4r → … → UDF1r. The two chains share STAGE_EN and MASTER_EN; only the FWD/REV selector differs. | 2× the program memory, but no conditional logic to debug. |
| DIR muxed chain | Single chain, UDF contains a 2:1 mux on LINK_IN driven by DIR (I2 = REV). FWD drives STAGE_EN of UDF1; REV drives STAGE_EN of UDF5. | Less memory. DIR pin must be debounced and held stable for the entire run. |
10-Second Off-Delay — Why It Is Non-Trivial
The specification says "each lamp extinguishes 10 s after it was turned on" — not "10 s after the last lamp came on". A single off-delay on the entire chain is therefore wrong. Each stage needs its own timer. The off-delay block in LOGO! Soft Comfort is B005 (Off-delay) with parameter Ta = 10.0 s.
Behaviour summary of B005 in LOGO! Soft Comfort V8:
| Parameter | Value | Note |
|---|---|---|
| Ta | 10.0 s | Off time |
| Reset input R | NOT MASTER_EN | Holds the output off during power-up and after emergency stop |
| Retentivity | Disabled | Countdown should restart on each rising edge of trigger |
Edge-triggered variant: if the spec requires "10 s after the last rising edge of the lamp signal", use Edge-triggered off-delay (B006 in Soft Comfort). It ignores re-triggers during the timing phase, which prevents the off-time from being extended if the lamp flickers.
Multi-Page Organisation with Off-Page Links
LOGO! Soft Comfort supports sub-routines and off-page connectors (the "scissors" tool). For a 5-stage application this is overkill, but as the program grows, multi-page helps:
- Put the UDF library on Page 1.
- Put the calling sequence on Page 2.
- Use a pair of off-page connectors named
LAMP_BUSto carry the five lamp signals to the I/O mapping on Page 3.
Open the tool, place an off-page connector, right-click → Edit → Scissors, and a wire passing through it is split into two named halves on different pages. This is the off-page link feature referenced in the field discussion — it does not change execution, only the visual presentation.
Parameter Table for the Full Solution (UDF Method)
| Block # | Type | Parameters | Wired To | Notes |
|---|---|---|---|---|
| B001 | Asynchronous pulse generator | TH = 2 s, TL = 0 s | → M_CLOCK | 2 s cadence |
| B002 | XOR | none | I1, I2 → M_DIR | Indicates active direction |
| B003 | AND | none | M_CLOCK, M_DIR → M_TICK | Clock only when a direction is selected |
| UDF1..UDF5 | User Defined Function (Stage) | Ta_on = 2 s, Ta_off = 10 s | STAGE_EN, MASTER_EN, DIR, LINK | Five instances |
| B020..B024 | Off-delay (inside UDF) | Ta = 10 s | M_ON → Q1..Q5 | Internal to UDF |
Commissioning Procedure
- Connect the LOGO! base module to 24 V DC on terminals L+ and M.
- Wire I1 to S_FWD, I2 to S_REV, I3 to MASTER_EN (or strap I3 to L+ for permanent enable during testing).
- Open LOGO! Soft Comfort, File → New → LOGO! 8.
- Open the UDF Editor, build the stage UDF as in section 3.2, and save it as
STAGE_UDF.lma. - On the main FBD page, drag five
STAGE_UDFinstances into a single horizontal row. - Wire LINK_OUT of UDF1 to LINK_IN of UDF2, and so on. For reverse test, re-wire UDF5 → UDF4 → … → UDF1.
- Set all DIR pins to a flag M_REV (0 = FWD, 1 = REV) driven by I2.
- Map UDF1..UDF5 LAMP outputs to Q1..Q5 in the I/O list.
- Click Simulation → Start and verify the staircase on the virtual outputs.
- Click PC → LOGO!, choose Ethernet or USB, and download.
- Run with the lamps connected; verify each Q output with a multimeter and observe the 10 s off behaviour with a stopwatch.
Verification Checklist
| Test | Procedure | Pass Criterion |
|---|---|---|
| Forward timing | Press S_FWD, start stopwatch | H1 on at 2.0 s ± 0.1 s, H2 on at 4.0 s, H3 at 6.0 s, H4 at 8.0 s, H5 at 10.0 s |
| Reverse timing | Press S_REV | H5 on first, then H4..H1 with the same 2.0 s spacing |
| Off-delay | Press S_FWD, leave S_FWD held | H1 turns off 10.0 s ± 0.2 s after H1 turned on; later lamps do not affect H1 |
| Hold behaviour | Press S_FWD for 1 s, release, wait | Sequence continues; no re-trigger of completed stages |
| Master enable off | Drop I3 while lamps are on | All lamps off within 200 ms; restart on I3 re-energise |
| Direction conflict | Press FWD and REV simultaneously | No lamp energises; XOR-driven interlock holds |
| Power cycle | Remove 24 V, restore | All lamps off; UDF internal state cleared (default non-retentive) |
Troubleshooting Matrix
| Symptom | Likely Cause | Action |
|---|---|---|
| No lamp at all | MASTER_EN (I3) not asserted; UDF instances all have STAGE_EN=0 because XOR output is 0 | Verify I3 high; verify XOR truth table with I1, I2 input indicators |
| All lamps on at once | Off-delay Ta is 0 s or off-delay block missing | Check B020..B024 parameter Ta |
| Sequence starts but stalls after 2 s | LINK wire from UDF1 to UDF2 missing or routed to wrong pin | Hover over each UDF pin in online mode; confirm LINK_OUT toggles |
| Lamp flickers | On-delay retried because STAGE_EN is not a one-shot | Place a 1-cycle pulse relay on STAGE_EN, or use edge-triggered on-delay (B002) |
| Reverse direction dead | DIR pin never sees ‘1’ because I2 is wired to the wrong terminal | Use LOGO! display mode or web server to view M_REV online |
| Off-time too long | Edge-triggered off-delay (B006) in use; flicker re-triggers it | Switch to plain off-delay (B005) if the lamp can flicker; conversely, switch to B006 if the lamp is on a mechanical switch |
| Download fails, "Memory exceeded” | Two full UDF chains instantiated (FWD + REV), each with 5 instances of a 12-block UDF | Reduce to a single chain with the DIR-muxed variant; or increase the LOGO! memory card size to 256 kB |
Edge Cases and Field Notes
- Power-up restart. All UDF timers in this design are non-retentive. A power cycle resets the chain; a brown-out does the same. Add retentivity only if the application explicitly requires resume-from-stage-N.
- Long sequences. The same UDF scales to 32 stages (the LOGO! shift register maximum); for longer chains, use a counter (B010 — Up/down counter) and a comparator, with the counter value selecting which lamp is on.
-
Analog variants. If "10 seconds" must be operator-tunable, expose a LOGO! variable
VW0(LOGO! Soft Comfort: Parameter VM mapping) and connect it to the off-delay Ta input. The LOGO! onboard display or TDE will then let the operator edit the value without a PC. - Web server. LOGO! 8 exposes a built-in web page. The five LAMP flags can be added to the user-defined web dashboard for remote visualisation; right-click any flag → Web server → Show on user page.
- Lamp inrush. If the lamps are LED clusters, inrush is negligible and a single Q output drives them. If they are incandescent 24 V panel lamps, inrush is 6×–10× the steady current; derate Q output to 0.3 A or interpose an external relay.
Comparison of Strategies
| Criterion | Cascaded Timers | Shift Register | UDF (Recommended) |
|---|---|---|---|
| Block count for 5 stages | ≈ 25 FBD blocks | 1 shift register + 5 decoders | 5 UDF instances + clock |
| Scalability to 10 stages | Linear growth, diagram unreadable | One block, parameter change | Add more UDF instances |
| Reusability | None | Low | High (UDF in library) |
| Reverse direction | Duplicate the chain | Second shift register, pre-load bit 5 | Re-wire LINK chain or use DIR mux |
| Readability on printout | Poor | Medium | Excellent |
| Commissioning time | 20–30 min | 10–15 min | 5–10 min after UDF is built |
| LOGO! Soft Comfort version | V5+ | V8.0+ (shift register block) | V8.0+ (UDF feature) |
References to Siemens Documentation
The UDF, shift register, and asynchronous pulse generator blocks are documented in:
- LOGO! 8 System Manual (6ED1050-xxx08-0BA1) — chapters 4.4 (UDF), 4.3 (timers), 4.3.3 (off-delay).
- LOGO! Soft Comfort V8.3 Online Help — search "UDF" and "Shift register".
- LOGO! product page — for current catalog numbers and firmware status.
How many UDFs can a single LOGO! 8 program contain?
LOGO! Soft Comfort V8 supports up to 8 User Defined Functions per program, each with a maximum of 8 inputs and 4 outputs. A UDF body may itself contain nested UDFs (V8.2+), so a single stage UDF can be a wrapper around smaller UDFs such as a "Pulse" and a "Debounce" sub-block.
What parameter scales the on-time and off-time in the UDF method?
Inside the UDF, an On-delay block (B001) with Ta = 2.0 s produces the inter-stage interval, and an Off-delay block (B005) with Ta = 10.0 s produces the per-lamp hold time. Expose these as LOGO! variables (VW0, VW1) if operator tuning is required.
Why does my sequence stall after the first stage?
The LINK_OUT of UDF1 is not connected to LINK_IN of UDF2, or the wiring is on the wrong pin (LINK_IN and STAGE_EN are separate pins in the UDF). Open the program in online mode and observe the LINK_OUT flag of UDF1; it must toggle exactly 2.0 s after STAGE_EN rises.
Can the same UDF drive both forward and reverse directions?
Yes. Either instantiate two chains (cleaner) or add a DIR pin to the UDF and route LINK through a 2:1 mux inside the body (more memory-efficient). For both methods, the FWD/REV inputs must be debounced and mutually exclusive; an XOR block plus a 50 ms on-delay is the typical interlock.
Does the off-delay reset if the lamp is briefly re-triggered?
With a plain Off-delay block (B005) it does: the timing restarts on every rising edge of the trigger. To ignore re-triggers during the timing window, use the Edge-triggered off-delay block (B006) and check the "Edge-triggered" option. This is the safer choice for a sequence where the lamp output is wired directly to Q without a latch.