IMDHMIControls LibraryShop main store

How-to

Repeating a forward reverse sequence on an Omron PLC ladder timer

PLC programming Published 10 min read

Short answer

Run the forward and reverse outputs from the PLC's normal cyclic scan and gate both commands with one 30-second run timer; when its completion flag turns ON, it removes the run permission and both outputs drop. A backward jump is unnecessary, delays scan completion and can trip the CPU watchdog.

On this page
  1. How do you repeat a forward reverse sequence for 30 seconds in an Omron ladder?
  2. How do you build the ladder rung by rung?
  3. Why does a backward jump not loop the ladder?
  4. Which timer completion flag ends the run?
  5. Example: what presets time a 30 second forward reverse window?
  6. How do you keep forward and reverse from ever commanding together?
  7. How do you restart the sequence after it switches off?
  8. How do you test the ladder before connecting the motor?
  9. Questions asked

You do not need a jump instruction to repeat a forward reverse sequence on an Omron PLC. The scan already repeats the whole program every cycle, so repetition is free; what you add is sequence state — one internal bit per step, dwell timers to advance between steps, and one 30-second run timer whose completion flag removes the run permission and drops both direction outputs. A backward jump is the wrong tool: it re-runs rungs inside a single scan, delays scan completion and can trip the CPU watchdog. This article builds the ladder rung by rung, times a four-step cycle inside the run window, works the preset arithmetic and lists the online checks to make before the motor is connected.

How do you repeat a forward reverse sequence for 30 seconds in an Omron ladder? #

Give the repetition to the scan and the stopping to one timer: state bits hold the current step across scans, and the run timer's completion flag kills the run permission so both direction outputs drop together at the window's end.

The repeat you are asking for already exists in the hardware. A PLC reads its inputs, solves the ladder, writes the outputs and starts over, continuously — that read-solve-write loop is the scan cycle, the mechanism described in What a PLC does: scan cycle, applications and advantages. Because the scan returns to every rung over and over, the program does not have to loop itself; it only has to remember where it is between scans, and that is what the state bits do.

IEC 61131-3 ladder, the language family this program is written in, is built for exactly this kind of cyclic execution — the logic is revisited every scan — which is why state bits rather than program-flow tricks express repetition in ladder.

What changes from scan to scan is the step: idle to forward dwell, forward dwell to gap, gap to reverse dwell, reverse dwell to return gap, return gap back to forward. Each transition fires when its dwell timer's completion flag closes, every transition checks the run permission first, and the window timer itself runs once per start without following the direction outputs.

Decision: repetition comes from the cyclic scan plus state bits; the only timer that ends the process is the run-window timer.

How do you build the ladder rung by rung? #

Eight rungs do it: internal bits for the idle, forward, gap, reverse and return states, four dwell timers, one run-window timer, and each physical output driven from its state bit ANDed with the run permission and the opposite-direction interlock.

  1. Assign the states. Give each step its own internal work bit — idle, forward dwell, forward-to-reverse gap, reverse dwell, reverse-to-forward gap — and write the logic so exactly one state bit is ON in any scan.
  2. Enter the dwell timers. One timer per timed step, enabled by that step's state bit, with the preset entered in the instruction's own time base and in the number format its help documents (BCD or binary, depending on the instruction).
  3. Enter the run-window timer. Enable it from the run permission — the start condition AND no timeout — never from a direction output; a window timer that follows an output restarts at every direction change and measures segments instead of the whole run.
  4. Wire the transitions. Forward dwell done hands over to the gap state, gap done hands over to reverse dwell, reverse dwell done hands over to the return gap, return gap done returns to forward — every handover conditioned on the run permission still being ON.
  5. Give the timeout priority. Put the window timer's completion flag into the run permission as a normally closed contact; when it closes, the permission dies and no handover anywhere in the program can keep a direction commanded.
  6. Drive each output once. Each physical output appears in exactly one rung: its own state bit, the run permission, and the NOT of the opposite direction command, so no later rung can re-assert what the cutoff cleared.
  7. Interlock the states. Include the NOT of every other state bit in each state rung, so a rung-order mistake cannot hold two states ON in the same scan.
  8. Re-arm on a start edge. An OFF-to-ON transition of the start input clears the state bits, resets the window timer and steps idle to forward; a start input that merely stays ON never counts as a new request.

Steps 2 to 4 are the same timed-sequence pattern used to build a siren ring count in ladder logic with a timer and counter: timers mark the intervals, and the state bits keep the place a counter would.

Decision: eight rungs of normally executed logic replace the jump instruction entirely.

Why does a backward jump not loop the ladder? #

A jump only skips rungs inside the scan it executes in: a jump back to an earlier label makes the CPU re-solve the same rungs within one scan, so it never creates the across-scan repetition you want and can stop the scan from finishing at all.

A jump's legitimate job is skipping over rungs to its matching label — bypassing a section that must not run — not driving a machine sequence. While the jump's condition stays true, the CPU loops inside that one scan and the scan time grows without limit; a scan that never finishes delays every other task in the controller and, depending on the CPU and the program, ends in a watchdog fault. The same one-scan rule that governs a REPEAT loop in PLC structured text — the loop body runs to completion within the scan — is what makes a backward jump at the end of a program dangerous instead of useful.

Skipped logic is the quieter failure: rungs inside the skipped span do not execute, so any timer, reset or output write living there freezes while the jump is active, and the direction outputs can hold their last state with nothing watching them. Your sequence needs the opposite — every rung visited every scan, so the state bits can move.

Decision: keep the jump out of this program; the scan is the loop and the state bits are the iteration.

Which timer completion flag ends the run? #

The window timer's completion flag: on an Omron timer it turns ON when the timer's present value reaches zero, and wired as a normally closed contact in series with the run permission it kills every direction command in the same scan.

Watch two signals online while the sequence runs. The present value must count down without restarting at a direction change — a restart means some rung is re-enabling or resetting the timer, and the fix is to enable it from the run permission. The flag must actually clear the outputs — outputs that hold with the flag ON mean a later rung is re-asserting them, and the output gating has a hole.

Timers in the Omron line differ in preset format and time base — the instruction help states the base and whether the preset is entered in BCD or binary — so verify what the preset represents before trusting it; the worked example below does that arithmetic. A run window is a delay that carries real work, unlike the decorative delays worth pruning, which is the distinction drawn in PLC timer best practices: when delays are necessary versus unnecessary.

Decision: one normally closed completion-flag contact in the run permission is the entire cutoff.

Example: what presets time a 30 second forward reverse window? #

Time one forward stroke and one reverse stroke to fill the window exactly: forward 10 s, gap 5 s, reverse 10 s, gap 5 s — the four steps sum to the full window and both outputs drop right on time.

This worked example assumes a 0.1 s time base for every timer, read from the instruction help; if your instruction's help shows 0.01 s, every preset below multiplies by ten. The dwell sum is 10 + 5 + 10 + 5 = 30 s, so one complete stroke — forward, gap, reverse, return gap — fills the window with nothing left over.

At the 0.1 s base the presets divide out directly: 10 s ÷ 0.1 s = 100 for the forward dwell, 5 s ÷ 0.1 s = 50 for each gap, 100 again for the reverse dwell, and 30 s ÷ 0.1 s = 300 for the window timer. The dwell presets add back to the window preset — 100 + 50 + 100 + 50 = 300 — so the stroke's own end and the window's end coincide, and the cutoff still wins because its normally closed contact sits in the run permission every output rung crosses.

At a 0.01 s base the same presets are 1000, 500, 1000, 500 and 3000. Enter them in the number format the instruction documents; a preset typed in the other format times a different interval, which a stopwatch on the first test catches immediately.

Decision: presets 100, 50, 100 and 50 with a window preset of 300 at a 0.1 s base — or 1000, 500, 1000, 500 and 3000 at 0.01 s.

How do you keep forward and reverse from ever commanding together? #

Three layers do it: mutually exclusive state bits, a NOT-opposite-direction contact in each output rung, and the hardware's own interlocking; if two direction commands ever appear in the same scan, the state logic is wrong and the machine must not run.

Write the handovers so one state bit sets as the previous one clears, and keep the NOT-every-other-state contacts from step 7 in place. Then watch for the rung-order race: a state bit written early in the scan can satisfy a later handover in that same scan, stepping the sequence through several states in one pass and stealing dwells. Moving all state writes to the end of the sequence block ends the race.

Clearing a PLC output is a control action, not a safety stop — the reversing contactors or drive keep whatever electrical and mechanical interlocking and protective functions the machine requires, independent of this ladder.

Decision: each physical output is written in exactly one rung, gated by state bit AND run permission AND NOT the opposite command.

How do you restart the sequence after it switches off? #

On a fresh start edge only: an OFF-to-ON transition of the start input clears the state bits, resets the window timer and steps idle to forward, so a button held through the cutoff cannot re-latch the run the instant it ends.

Condition the window timer's reset on that start edge, not on the sequence running: a reset that depends on the running sequence cannot clean up after the cutoff, and a start input still held then re-latches the run the moment anything clears, making the off period vanish. After the cutoff the run permission stays OFF until a new edge arrives, and the sequence sits in idle with both direction outputs written OFF.

Confirm in the test that idle, an aborted run and the post-cutoff state all write both direction outputs OFF — those are the states nobody watches and the ones a restarting machine meets first.

Decision: one start-edge rung owns re-arming; nothing restarts while the start input merely sits ON.

How do you test the ladder before connecting the motor? #

Run the logic online with the load disconnected and a stopwatch on the window: the forward and reverse outputs alternate one at a time, and both drop together when the window timer's completion flag closes.

Time the full window with the stopwatch and compare it against the preset's intended interval; a window off by a whole factor means the preset was typed in the other number format, and the stopwatch catches it before the motor ever sees a command. If the sequence races through several states in one scan, the state writes sit early in the rung order; if the window restarts at each direction change, its enable is following an output; if the outputs hold past the cutoff, a later rung re-asserts them. Each symptom points at one rung, and each fix is in the sections above.

Decision: no motor leads go on until a complete window cycles correctly with the outputs disconnected.

Questions asked

How many forward reverse strokes fit in the run window?

Divide the window by one full stroke. The example stroke runs forward 10 s, gap 5 s, reverse 10 s, gap 5 s, so one stroke fills the whole window. Use 4 s dwells with 1 s gaps and one stroke takes a third of the window, so three strokes fit exactly, and the completion flag still drops both outputs at the cutoff.

What changes when two contactors do the reversing instead of a drive?

Keep a both-off gap between the directions and prove actual release before the opposite contactor picks up. Use the contactor's auxiliary contact as the release feedback instead of treating the off command as proof, because a welded or sluggish contactor ignores its command. With a drive, follow the drive's documented direction-change method instead; the state machine is identical and only each handover's permission conditions differ.

How do you read the completion flag from structured text?

In structured text the same sequence needs no contacts: a timer instance exposes its completion flag as a Boolean member, so an IF on that member replaces the normally closed contact in the run permission. The member acts like a Boolean that tracks the ladder flag, and the preset arithmetic and the start-edge reset work the same way in code.

What should the first online test watch?

With the load disconnected, watch the logic online: at most one state bit and one direction command are ON in any scan, the state bits step in sequence order, and both direction commands are OFF by the next scan after the window timer's flag closes. Anything else means a rung-order race or a rung that re-asserts an output, and it must be fixed before the motor is connected.

Keep reading

  • How-to

    Program a CODESYS assembly line sequence in ladder logic

    Structure the line as one INT state variable with permissive-qualified station starts: TON timers of T#20s, T#40s and T#60s run the stations, Stop drops the run latch so everything pauses with the timers reset, and a CTU with a preset of 4 releases the vehicle on the fourth door. The Emergency Stop belongs in the safety circuit, with the PLC only monitoring it and clearing the sequence.

    PLC programming

  • How-to

    Structure dock door conveyor interlocks in Studio 5000

    Run the conveyor on three explicit states — Ready, Running and Restart-required — with door-open, truck-present and curtain-clear as permissives. Truck departure mid-cycle stops the conveyor and latches a manual restart; the light curtain's protective stop stays in safety-rated equipment. Fix the door sensor before debouncing, then size the timer to the measured flicker — 600 ms against a 240 ms example.

    PLC programming

  • How-to

    Build a siren pulse count sequence in S7-1200 ladder logic

    Use a positive-edge request to load a target of 3, 2, or 1 pulses, then run a four-state ladder sequence — idle, start, stop, count — that drives Q6.2 (START) and Q6.1 (STOP) from separate states so the two SIMOCODE Pro V commands never overlap. With a 2.0 s on-time and a 1.0 s gap, the three patterns finish in 11.0 s, 7.0 s, and 3.0 s.

    PLC programming