Application Overview
A small-form-factor controller (Siemens LOGO! 8 family or equivalent) drives a bidirectional motor through a sequence of homing, dwell, right-run, and left-run steps. Three functional requirements sit on top of the basic cycle: (1) deterministic approach to a single home reference, (2) pause/resume control from a front-panel cursor key at any step in the sequence, and (3) a hard-clamped maximum run time so a single user-set time parameter cannot exceed two minutes per direction.
The mechanical package consists of:
- AC or DC drive motor with two direction contactors (K1 = left, K2 = right)
- One cam-operated microswitch mechanically linked to the rotor, used as the single home reference
- Left and right limit switches for end-of-travel protection
- Operator start/reset pushbuttons and indicator lamps
- LOGO! base module (8 digital inputs, 4 relay outputs) with or without the LOGO! TDE text display
I/O Allocation
| Address | Symbol | Function | Wiring |
|---|---|---|---|
| I1 | HOME_REF | Cam microswitch, "home position reached" | NO contact, 24 V to terminal |
| I2 | STOP | Operator stop pushbutton (NC) | NC contact, break-to-stop |
| I3 | LIMIT_L | Left travel limit switch | NC contact, break-to-stop |
| I4 | LIMIT_R | Right travel limit switch | NC contact, break-to-stop |
| I5 | START_PB | Cycle start pushbutton | NO contact |
| I6 | DRV_FAULT | Drive / overload fault contact | NC contact from overload |
| Cu ▲ | CURSOR_UP | Start cycle | LOGO! front panel |
| Cu ► | CURSOR_RIGHT | Pause / resume | LOGO! front panel |
| Cu ▼ | CURSOR_DOWN | Reset cycle to HOME | LOGO! front panel |
| Q1 | MOTOR_L | Contactor K1, rotate left | 230 V coil, with interlock |
| Q2 | MOTOR_R | Contactor K2, rotate right | 230 V coil, with interlock |
| Q3 | RUN_LAMP | Green "cycle running" indicator | 24 V LED |
| Q4 | PAUSE_LAMP | Amber "paused" indicator | 24 V LED |
The cursor keys are configured in LOGO! Soft Comfort under File → Properties → Cursor Keys. Each cursor exposes a virtual input named Cu ▲, Cu ►, Cu ▼, and Cu ◄ in the FBD/LAD editor. On a LOGO! 8 BM the cursor keys are debounced in firmware; no external RC network is required.
State Machine Definition
The cycle is implemented as a four-state machine. A Merker (flag) word SM holds the current state, encoded 00 = HOME, 01 = DELAY1, 02 = RUN_R, 03 = RUN_L. Transitions are event-driven; the active timer is enabled only when the matching state is active and the PAUSE flag is clear.
- HOME — output Q1 (left) on; wait for I1 to close. The cam approach is always in the same direction so the home point is reproducible.
- DELAY1 — outputs off; on-delay timer T_dwell runs to the user-set dwell value.
- RUN_R — output Q2 on; on-delay timer T_run drives the rightward travel. The maximum permitted value of T_run is hard-clamped to 2 minutes regardless of what the operator enters at the parameter screen.
- RUN_L — output Q1 on; T_run drives the leftward travel. Same clamp applies.
When the sequence enters HOME on power-up, the controller first runs the motor left until I1 closes. From that reference point every subsequent cycle starts at a known angle, so any drift introduced by mismatched right- and left- run times is eliminated by the periodic re-homing implicit in step 1.
Homing Logic
HOME is the entry state on power-up and is also re-entered if the operator presses CURSOR_DOWN (reset) or if a fault is detected. The homing coil is wired as:
Q1_HOME = (state == HOME) AND NOT(I1) AND NOT(FAULT)
= (SM == 00) AND NOT I1 AND NOT B004 (fault latched)
The two cross-direction safety nets — a hard-wired NC limit switch in series with each contactor coil and the LOGO! software interlock Q1 AND NOT Q2, Q2 AND NOT Q1 — guarantee that the motor cannot be commanded in both directions simultaneously under any logic fault. The home position is considered "reached" the moment I1 closes. A 200 ms debounce on I1 prevents the controller from bouncing out of HOME on contact chatter from the cam.
Run Time With 2-Minute Clamp
Two timer function blocks are used: T_dwell (parameter T_dwell, set by the operator) and T_run (parameter T_run, also set by the operator). The 2-minute clamp is enforced with a second on-delay timer T_max that has its time base locked to 02:00m. T_max is started at the same instant the run-direction output is energized, and its done bit OR-gates into the run-complete condition.
T_run_done = T_run.Q // user-set time T_max_done = T_max.Q // 02:00m clamp RUN_complete = T_run_done OR T_max_done
This way, no matter what the operator enters for T_run — 5 s, 30 s, 5 m, 99 m — the actual run direction is de-energized at min(T_run, 2:00). The current run-time accumulator is reset only when the state transitions out of RUN_R or RUN_L; pressing pause does not reset it, which is what makes pause/resume work correctly.
| Block | Function | Time base | Setpoint | Reset |
|---|---|---|---|---|
| B001 | On-delay (T_dwell) | s | operator | R = NOT(state==DELAY1) |
| B002 | On-delay (T_run) | s | operator | R = NOT(state==RUN_R) AND NOT(state==RUN_L) |
| B003 | On-delay (T_max) | m | 02:00 | R = NOT(state==RUN_R) AND NOT(state==RUN_L) |
Pause / Resume With Cursor Right
The pause request is generated by a one-shot on CURSOR_RIGHT, which ensures that a long key hold does not toggle the pause state repeatedly. The PAUSE flag is a self-latching RS flip-flop:
B005 (RS) : S = edge(Cu ►) R = (state == HOME) AND I1
The flag is automatically cleared when the cycle returns to the HOME state and the home reference is reached; this gives the operator an implicit resume-from-home on every power-on. PAUSE is OR-gated with the state-active signal that drives each run timer, which is the standard pattern for "freeze the elapsed-time accumulator" on a LOGO! on-delay block.
On a LOGO! 8 the on-delay timer continues to count internally while its enable input is false; the elapsed-time value is held. The clean way to get a true pause is to use the AND of state-active and NOT PAUSE as the timer's enable, and route the timer's _Q output to the direction output through an AND with NOT PAUSE. That way the direction output drops the instant pause is requested, the timer stops counting, and when pause is released both the output and the timer resume at exactly the previous elapsed value.
Q1 = (state==HOME AND NOT I1) OR (state==RUN_L AND NOT PAUSE AND NOT T_run.Q AND NOT T_max.Q AND NOT LIMIT_L) Q2 = (state==RUN_R AND NOT PAUSE AND NOT T_run.Q AND NOT T_max.Q AND NOT LIMIT_R)
PAUSE_LAMP (Q4) is wired directly to the PAUSE flag so the operator can see the latched state on the panel.
Parameter Screen
LOGO! Soft Comfort allows up to 32 parameters to be exposed on the on-board text display. For this application only two are needed:
| Parameter | Symbol | Range shown | Resolution |
|---|---|---|---|
| T_dwell | "dwell" | 0 s – 60 m | 1 s |
| T_run | "run time" | 1 s – 99 m | 1 s |
The clamp timer T_max is not exposed; its value is fixed at 02:00m in the program and is not operator-adjustable. If the operator enters 30 m for T_run, the run step terminates at 2:00m; if they enter 45 s, the run step terminates at 45 s. The minimum of the two wins because both done bits are OR-gated.
Ladder / FBD Implementation
The complete sequence fits in roughly 24 blocks on a LOGO! 8. The block list and their connections are:
| Block | Type | Inputs | Output | Comment |
|---|---|---|---|---|
| B001 | On-delay | Trg=state01, R=¬(state01) | _Q | T_dwell |
| B002 | On-delay | Trg=state02 OR state03, R=¬(state02 OR state03) | _Q | T_run |
| B003 | On-delay | Trg=state02 OR state03, R=¬(state02 OR state03) | _Q | T_max clamp 2:00m |
| B004 | RS flip-flop | S=¬STOP OR FAULT, R=Cursor_Up | Q | Fault latch |
| B005 | RS flip-flop | S=edge(Cu►), R=(state00 AND I1) | Q | PAUSE flag |
| B006 | AND | B002._Q, B003._Q | Q | Run complete (combined) |
| B007 | OR | state02, state03 | Q | Run active |
| B008 | AND | B007.Q, NOT B005.Q | Q | Run active AND not paused |
The state word SM is implemented as a 2-bit binary counter advanced by the "state complete" pulses: state00 is reset when I1 closes; state01 advances on T_dwell done; state02 advances on run-complete in the right direction; state03 advances on run-complete in the left direction. A simple shift register (B009 Shift register, 4 bits) holds the state vector; the shift clock is the OR of all state-exit conditions.
Verification and Commissioning
- With the motor uncoupled, force each contactor manually with the LOGO! online monitor and confirm direction matches the label on the panel.
- Re-couple the motor, set T_dwell = 5 s and T_run = 5 s. Press CURSOR_UP and observe: HOMING (Q1 on, motor rotates left), Q1 drops on I1, 5 s of dwell, Q2 on for 5 s, Q1 on for 5 s, dwell, repeat.
- Set T_run = 30 s and verify that the right and left outputs each drop at 30 s.
- Set T_run = 99 m and verify that the right and left outputs each drop at exactly 2:00 (T_max clamp active).
- Press CURSOR_RIGHT during a run output. The output must drop within one LOGO! scan (typically 10–20 ms for this block count). The PAUSE_LAMP must light. The T_run elapsed-time display on the LOGO! TDE must hold its value.
- Press CURSOR_RIGHT again. The run output must re-energize and T_run must continue counting from the held elapsed value. The PAUSE_LAMP must clear.
- Press CURSOR_DOWN during a run step. The run output must drop, the cycle must return to HOME, and the home cam must be re-approached from the left.
- Trip the overload contact (I6). The fault latch (B004) must engage, both direction outputs must drop, and the cycle must not auto-restart on fault recovery. CURSOR_UP must be required to clear the fault.
- Power-cycle the LOGO! and confirm retention: a LOGO! 8 with the optional battery / SD card keeps Merker bits; a battery-less LOGO! returns to HOME on power-up regardless.
Troubleshooting Matrix
| Symptom | Likely cause | Diagnostic | Fix |
|---|---|---|---|
| Motor does not respond to CURSOR_UP | Fault latch B004 set | Online monitor: B004.Q = 1 | Investigate I6 / STOP; clear with CURSOR_UP |
| Run output drops too early | T_max clamp reached (T_run set too high) | Online monitor: T_run > 02:00m | Reduce T_run; verify B003 setpoint = 02:00m |
| Pause does not freeze the timer | PAUSE flag not wired into the timer enable | Online monitor B005.Q during pause request | Add AND of state-active and NOT B005.Q to Trg input of B001/B002 |
| Home position drifts cycle-to-cycle | Asymmetric right vs left run time without re-home | Use the built-in trend view to log I1 edges | Reduce T_run asymmetry; verify HOME state always re-entered on every cycle |
| LOGO! TDE shows "Parameter: run time" but no clamp visible | Expected: clamp is enforced in program, not on the parameter | n/a | Document the clamp in the operator manual; the program is the authority |
| Direction output stuck on after CURSOR_DOWN | RESET not implemented; cursor down only sets a flag, doesn't drop the output | Online monitor state word | Wire B005.R to (state==HOME AND I1) so pause clears on home; wire a separate RS latch on CURSOR_DOWN that forces the state word to 00 |
| Both Q1 and Q2 chatter on limit switch opening | Software interlock missing or duplicated with hardware | Online monitor Q1 and Q2 simultaneously | Add Q1 AND NOT Q2 and Q2 AND NOT Q1 in series with each output |
| T_run appears to be paused but Q2 still on | Output not gated by NOT PAUSE | Online monitor Q2 and B005.Q | Add AND NOT B005.Q on the Q2 rung |
Edge Cases and Field Notes
- Power loss during run. On a battery-less LOGO! 8, all Merker bits clear on power-up. The cycle returns to HOME; the in-progress turn is interrupted and the motor re-homes. This is the desired behavior for a position-critical load.
- Operator changes T_run while running. The new value takes effect on the next state entry. The current run finishes with the value that was active at state entry. This is intrinsic to the LOGO! on-delay block — there is no "live reload" path.
- Cursor right held down. The edge detector on B005.S ensures a continuous press toggles once, on the press transition. Release and re-press toggles again. This matches operator expectation.
- Stuck cam switch. If I1 fails closed (welded), the HOME state is never entered and the cycle does not start. If I1 fails open, the cycle will run to the first I1 closing but cannot re-home between cycles — the run times will then accumulate any asymmetry. The FAULT word should be extended to include an I1-welded check: if the controller enters HOME and I1 is already high, latch a "HOME sensor fault" and refuse to start.
- Two-minute clamp on the dwell timer. T_dwell is intentionally not clamped; if the operator wants a long dwell between cycles, they get it. Add a second T_max to clamp the dwell at 30:00m or whatever the application requires.
- Scan-time jitter. The state machine runs synchronously with the LOGO! scan; for a typical program of this size the scan is 8–15 ms. The 200 ms I1 debounce masks this jitter on the home input. If the application requires sub-10 ms response, switch the cycle to interrupt-driven I/O or move to a LOGO! 8.3 with the faster BM.
- Multiple starts. The CURSOR_UP key should be edge-detected (single press starts one cycle). Holding the key does not queue additional cycles. A long press that is released and re-pressed within 1 s can be debounced to a no-op.
Adaptation to Other Controllers
The same pattern maps cleanly to any controller that exposes an on-delay timer with a held-elapsed-time behavior. On an Allen-Bradley MicroLogix 1400 use a TON with the enable rung gated by NOT PAUSE; on a Schneider Electric Modicon M340 use %TM with IN gated by NOT PAUSE; on a Siemens S7-1200 use an IEC timer (TP, TON, TOF) inside an FB with the enable input gated. The two-minute clamp becomes a second TON with a fixed preset; the OR of the two done bits drives the run-complete condition.
On a LOGO! 6/7 (no cursor keys on the base module) the cursor inputs are replaced with discrete pushbuttons wired to I5, I6, I7. The logic is otherwise identical. The LOGO! TDE text display exposes the cursor keys in exactly the same way, so adding a TDE to a LOGO! 7 project that was designed with hard-wired buttons requires only remapping the symbol names from I5/I6/I7 to Cu ▲ / Cu ► / Cu ▼.
Standards and Safety References
Motor direction contactors with mechanical interlock conform to IEC 60947-4-1. Emergency stop wiring must follow ISO 13850. Hard-wired cross-interlock between K1 and K2 is required to maintain category 1 or better stop behavior per ISO 13849-1. The LOGO! software interlock is supplementary; it does not replace the hard-wired interlock and must not be relied on for safety stop.
Refer to the LOGO! 8 system manual (Siemens support entry 109741041) for the complete instruction set, block reference, and parameter screen configuration procedure. The product page is at siemens.com/LOGO. For the LOGO! TDE text display and the cursor-key programming model see the LOGO! Soft Comfort online help, included in the installation under Help → Contents → Cursor Keys.
FAQ
How do I enable cursor keys as inputs in LOGO! Soft Comfort?
Open File → Properties → Cursor Keys in the LOGO! Soft Comfort project. Tick the boxes for the cursor positions you want to use; the editor inserts the matching Cu ▲, Cu ►, Cu ▼, Cu ◄ virtual inputs at the left rail. Deploy with PC → LOGO! and the keys become live on the base module or the LOGO! TDE.
How is the 2-minute maximum run time enforced if the operator enters a larger value?
A second on-delay timer T_max is configured with a fixed preset of 02:00m. Its done bit is OR-gated with the user-set timer's done bit to drive the run-complete condition. Whichever of the two finishes first ends the run step, so the effective run time is min(T_run, 02:00m).
Does pressing pause reset the run-time accumulator?
No. The pause flag is AND-gated with the state-active signal that drives the run timer's enable input. When pause is asserted, the timer's enable drops; the elapsed-time value is held. When pause is released, the timer resumes from the held value. The run output is also gated by NOT pause so the motor stops and restarts cleanly.
Can the cycle restart automatically after a power loss?
On a battery-less LOGO! 8 all Merker bits clear on power-up and the cycle returns to HOME; no auto-restart. With the LOGO! Battery 6ED1057-1MC00-0BA0 (CR2032 in the base module) or a LOGO! SD card installed, retained Merker bits keep the cycle state and the motor continues from the held step on power recovery. Choose the variant that matches the application's safety analysis.
Why does the home position drift if right and left run times are not equal?
Asymmetric run times accumulate a small angular error each cycle. The four-state machine re-runs the homing step (state HOME) at the start of every cycle, which compensates for the error. If you bypass HOME the drift will accumulate visibly within tens of cycles.