Skip to main content
Call Eric:863-698-8266
CURRYCONTROLS.COMControls & Automation Knowledge Hub
How-ToHow-ToPLCProgrammingControlDesign

How to Build a Sequencer

Build a step sequencer in a controller that will not stick, restart into the wrong step, or leave equipment half way: define the steps from the narrative, choose a step register, and test every path before the plant depends on it.

9 min readUpdated Sep 5, 2026Published Sep 5, 2026By Eric Sullivan

The short answer

How to Build a Sequencer

To build a sequencer, write the sequence as a numbered list of steps from the control narrative, each with what it does and what ends it; hold the current step in one integer register; write one rung or statement per transition that advances the register when the exit condition is true and the step timer has not expired, and one that sends it to a fault step when the timer expires; drive every output from the step number, never from the transition logic; add an idle step for power-up and reset, a hold step for pauses, and an abort path from every step; and test it by walking every transition, every timeout, and every abort with the equipment simulated, then live.

Key points

  • One integer register holds the step; every output is a function of that register.
  • Every step has an exit condition and a timeout; the timeout goes to a fault step.
  • Idle, hold, and abort steps are part of the design, not afterthoughts.
  • Transitions change the step; they never drive outputs directly.
  • Test every path, including the ones that should never happen, before the plant relies on it.

What you need

  • The control narrative with the sequence of operations
  • The I/O list for the equipment in the sequence
  • The programming software for the controller and a test controller or emulator
  • A step table: number, name, action, exit condition, timeout, abort behavior
  • A screen or a watch table to display the step and the timers

Procedure

  1. 1

    Write the step table

    From the narrative: step number, name, what the step does, what ends it, how long it may take, and what happens on abort. Step 0 is idle. Include a fault step and a hold step. Get the operator to read it.

  2. 2

    Choose the step register

    One integer, retentive if the sequence must resume after a power loss, otherwise cleared to idle on first scan. Name it for the sequence.

  3. 3

    Write the transitions

    For each step, one rung: if step equals N and the exit condition is true, set step to N plus one, or to the branch target. One more rung: if step equals N and the step timer has expired, set step to the fault step and record which step timed out.

  4. 4

    Write the abort

    One rung: if the abort condition is true and the step is not idle or fault, set step to the abort step, which shuts things down in order and then returns to idle.

  5. 5

    Drive the outputs

    For each output, a rung that energizes it when the step register equals any of the steps that need it. Outputs are never set in the transition rungs.

  6. 6

    Add hold and resume

    A hold command sets a hold flag and stores the current step; the outputs that must drop during a hold are gated by the flag; resume restores the step.

  7. 7

    Reset the step timer

    A timer that runs while the step is unchanged and resets when the register changes; its preset is the timeout for the current step from a table or a case statement.

  8. 8

    Show it

    Step number and name, time in step, the transition being waited for, and the last fault step on a screen; the sequence is debuggable only if it is visible.

  9. 9

    Test offline

    On an emulator or a test controller with inputs simulated: every transition, every timeout, every abort, hold and resume from every step, and power loss in the middle.

  10. 10

    Test live

    With the equipment, with an operator watching each step, with the timeouts real; then with each failure induced.

The pattern: transitions change the step, outputs follow the step
// Step register: SEQ_STEP
// Step 2: open inlet valve, wait for open limit, 30 s timeout
IF SEQ_STEP = 2 AND VALVE_OPEN_LS THEN SEQ_STEP := 3; END_IF;
IF SEQ_STEP = 2 AND STEP_TIMER.Q THEN FAULT_STEP := 2; SEQ_STEP := 99; END_IF;
// Output: inlet valve open command is a function of the step
VALVE_OPEN_CMD := (SEQ_STEP = 2) OR (SEQ_STEP = 3) OR (SEQ_STEP = 4);

Rules

  • Never write the same output from two places.
  • A step that waits on the field has a timeout; a step that only waits on a timer is a timer step.
  • Branches use the same pattern with different targets; loops jump back to an earlier step with a loop counter and a limit.
  • The fault step records which step failed and holds until reset; the abort step drives outputs to their safe state in order.
  • Power-up goes to idle unless the design says resume, and resume requires an operator confirmation.

Frequently asked questions

How do I handle two things that must happen at once?
Either put both in the same step, since a step can drive several outputs, or run two sequencers with their own step registers and a handshake step in each. Two sequencers writing the same output is the error to avoid.
The sequence sticks in a step and nobody notices.
The step has no timeout, or the timeout is hours. Every step waiting on the field has a timeout measured in the time the field action should take plus margin, and the fault step alarms.
Should the sequence resume after a power loss?
For a backwash or a clean-in-place, usually restart from a safe step with operator confirmation; for a batch with chemistry in progress, resume the held step after confirmation. The narrative decides, and the step register is retentive only if resume is chosen.
How do I test a sequence without running the equipment?
On an emulator or a spare controller with the inputs forced or simulated by a test routine that mimics the field responses, walking every transition. Then live with each step confirmed by an operator.

Direct contact

Have a controls question?

Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.