Learn PLCs free
Platform Comparison10 min read3 719 words

PLC Latch vs Unlatch (Set/Reset): How OTL and OTU Work

PLC latch and unlatch explained — how OTL/OTU (set/reset) retain state, latch vs a seal-in rung, retentive behavior on power loss, and when to use each.

IAE
Senior PLC Programmer
15+ years hands-on experience • 50+ automation projects completed
PLC
Programming Excellence

A PLC output bit normally follows its rung condition exactly — energized when the rung is true, de-energized when it goes false. Latch and unlatch instructions break that rule on purpose. Once latched, a bit stays ON regardless of what happens to the enabling condition. Once unlatched, it stays OFF until explicitly set again. Understanding when — and when not — to use this behavior is a fundamental PLC programming skill.

This tutorial covers OTL and OTU coils (Allen-Bradley / Rockwell nomenclature), the equivalent Set/Reset instructions used by Siemens, Omron, and Mitsubishi, the IEC 61131-3 SR and RS function blocks, and the crucial safety caveat that catches new programmers off guard.


What Latch and Unlatch (OTL/OTU, Set/Reset) Do

The core job of a latch instruction is to retain a bit in the ON state after the enabling condition goes away. Its partner, the unlatch instruction, forces that same bit OFF and keeps it there until the latch fires again.

Instruction Allen-Bradley Siemens IEC 61131-3 Effect
Latch / Set OTL S (Set coil) SR block — S input Forces bit ON; bit stays ON
Unlatch / Reset OTU R (Reset coil) SR block — R1 input Forces bit OFF; bit stays OFF

The bit being controlled does not need a conventional output (OTE) coil anywhere in the program. Its only control points are the OTL and OTU rungs (or S/R coils). That is what makes it fundamentally different from a normal output: the bit outlives the conditions that set it.

PLC latch OTL versus unlatch OTU Set Reset coil behavior comparison Side-by-side comparison showing OTL (latch) forcing a bit ON and retaining it after the enable condition drops, and OTU (unlatch) forcing that same bit OFF and retaining it until the latch fires again. OTL — Output Latch (Set) AB: OTL | Siemens: S coil | IEC: SR block S input Enable rung: Bit state: Bit latches ON Rung goes FALSE Bit STAYS ON Effect: forces bit to 1 Retains: bit stays 1 until OTU clears it Retentive on power loss (most PLCs) OTU — Output Unlatch (Reset) AB: OTU | Siemens: R coil | IEC: SR block R1 input Enable rung: Bit state: Bit unlatched OFF Rung goes FALSE Bit STAYS OFF Effect: forces bit to 0 Retains: bit stays 0 until OTL sets it Retentive on power loss (most PLCs)
OTL vs OTU timing: OTL forces the bit ON and it remains ON after the rung goes false; OTU forces the bit OFF and it remains OFF until the next OTL fires — neither follows the rung state passively.

How They Work — Scan-by-Scan

During every PLC scan, the processor evaluates each rung left to right, top to bottom. For a normal OTE coil, the output mirrors the rung result each scan. For OTL/OTU:

  1. OTL rung goes TRUE → the addressed bit is written to 1 in the output image table. It stays 1 even if the rung goes FALSE on the next scan.
  2. OTU rung goes TRUE → the addressed bit is written to 0. It stays 0 even if the OTU rung subsequently goes FALSE.
  3. Both rungs FALSE → the bit retains whatever value was last written. The processor does not touch it.

This "last-writer-wins" model means the physical order of rungs matters. If an OTL and OTU for the same bit both go TRUE in the same scan, the instruction that appears lower in the program wins, because it executes last.

| Start_PB |---[ ]-----------------------------(OTL Motor_Run)
|
| Stop_PB  |---[ ]-----------------------------(OTU Motor_Run)
|
| Motor_Run|---[ ]---[ Overload ]---[/]----(OTE Motor_Starter)

In the example above, Motor_Run is the latched bit. The physical motor starter output is driven by a separate OTE rung that includes an overload interlock. This separation — latch bit versus output coil — is a clean, deliberate design pattern.


Latch vs a Seal-In (Hold-In) Rung — Pros and Cons

Most PLC introductions teach the seal-in rung first. It uses a normally open contact from the output itself in parallel with the momentary start pushbutton:

| Start_PB  Motor_Run                                        |
|---[ ]---+---[ ]---+---[ Stop_PB ]---[/]---(OTE Motor_Run) |
|         |         |                                        |
|         +---------+                                        |

When Start_PB closes, Motor_Run energizes and the self-holding contact seals it in. Stop_PB (wired normally closed) breaks the path and drops the output.

See motor start/stop ladder logic for a full walkthrough of the seal-in pattern.

When a seal-in is better

  • Power-loss behavior is predictable — the output drops on power loss because the seal-in contact opens when the coil de-energizes. On restart, the machine is in a known safe state. This is the single biggest safety advantage.
  • One rung, self-contained — easier to trace and understand at a glance.
  • The stop condition is explicit — you can see exactly what breaks the path.
  • Less risk of leaving a bit latched accidentally — the output cannot stay ON if power is removed and restored.

When a latch/unlatch is better

  • Multiple set conditions, multiple reset conditions — if several independent events can start or stop a process, encoding all of them into one seal-in rung grows unwieldy. Separate OTL/OTU rungs keep the logic modular.
  • Set and reset are geographically separated — in large programs, the set logic may live in a production routine and the reset logic in a fault-handling routine. OTL/OTU let you spread them across the program without cross-referencing the same coil.
  • Alarm and fault bits — a fault detected in one routine (OTL) should remain latched until an operator acknowledges it in another routine (OTU). A seal-in rung cannot span routines cleanly.
  • State machine transitionsadvanced ladder logic techniques often use latched bits as state flags rather than live-process outputs.

Summary comparison:

Criterion Seal-in rung OTL / OTU
Safe on power loss Yes — drops to OFF Retains state (risk)
Scales to multiple set/reset conditions Awkward Clean
Self-documenting High Moderate
Spans multiple routines No Yes
IEC 61131-3 compliant equivalent SR / RS blocks
Seal-in rung versus OTL OTU latch unlatch motor start stop ladder logic comparison Side-by-side comparison of seal-in rung and OTL/OTU latch pattern for motor start-stop control, showing power-loss behavior and structural differences. SEAL-IN RUNG Self-holding single coil pattern Start Run seal Stop N/C Run OTE On power loss: drops to OFF Requires new start command after restoration — safe Best for: direct motor outputs and safety-related control OTL / OTU PATTERN Separate set/reset rungs Start Run OTL Stop Fault Run OTU On power loss: retains state May re-energise on power-up Supports multiple reset paths Best for: status flags, alarms, cross-routine state bits
Seal-in vs OTL/OTU: the seal-in rung inherently drops to OFF on power loss (safer for motor outputs); OTL/OTU retain state across power cycles and support multiple independent reset paths.

Retentive Behavior on Power Cycle — and the Safety Risk

This is the section that catches new programmers, and it causes real-world incidents.

OTL/OTU bits are retentive by default on most Allen-Bradley platforms. When a ControlLogix or CompactLogix processor loses power, the output image table is saved to battery-backed (or capacitor-backed) SRAM. When power is restored, the processor reloads that image. A bit that was latched ON before power loss comes back ON before the first scan completes.

The consequence: a latched motor output can re-energize the moment power is restored, before any operator action, before any permissive checks, before any start command.

This is why E-stops and safety-rated outputs must never rely solely on an OTL/OTU bit to control them. Safety standards (ISO 13849, IEC 62061) require hardwired safety relays or certified safety PLCs with monitored safe states — a software latch bit does not meet that requirement.

Safety caution: If your application could restart automatically after a power interruption, use a seal-in rung (which requires a new start command after power restoration) rather than a latched bit for the run output. Reserve OTL/OTU for status flags, alarm bits, and state variables that are explicitly reviewed during a controlled restart sequence.

On platforms where you want latch behavior without retentivity, some manufacturers offer non-retentive set/reset coils. Check your platform's instruction set — on Siemens S7, the S and R coils are retentive; on some Omron platforms, specific coil types control retentivity independently.

OTL OTU retentive behavior on PLC power loss showing bit state across power cycle Timeline diagram showing that a latched OTL bit remains ON through a power loss and power restoration event on ControlLogix, compared to a seal-in rung which drops to OFF during the outage. Power-Loss Behavior: Latched Bit vs Seal-In t=0 Power loss Power restored 1st scan Power ON Power OFF Power ON OTL bit retained in SRAM re-energises immediately Seal-in OFF — coil drops with power needs new start cmd OTL bit (retentive) Seal-in bit (non-retentive)
Power-loss behavior: a latched OTL bit is retained in battery-backed SRAM and re-energises on the first scan after restoration — a potential safety hazard. A seal-in rung drops to OFF and requires a deliberate restart command.

Set/Reset (SR/RS) Function Blocks in IEC 61131-3

The IEC 61131-3 standard defines two function blocks that formalize latch/unlatch behavior.

SR (Set-dominant)

+-------+
S  --|  SR  |--  Q1
R1 --|       |
     +-------+
  • If both S and R1 are TRUE simultaneously, S wins — the output Q1 is ON.
  • If S goes TRUE → Q1 latches ON.
  • If R1 goes TRUE (and S is FALSE) → Q1 resets to OFF.

RS (Reset-dominant)

+-------+
S1 --|  RS  |--  Q1
R  --|       |
     +-------+
  • If both S1 and R1 are TRUE simultaneously, R wins — the output Q1 is OFF.
  • Preferred for safety-related applications because a simultaneous set+reset defaults to the de-energized (safe) state.

In Allen-Bradley Studio 5000, you access SR/RS blocks through the function block diagram (FBD) editor or as structured text constructs. In Siemens TIA Portal, the SR and RS blocks are available in both LAD and FBD editors.


A Ladder Example: Start/Stop with Set/Reset

The following is a practical implementation of a conveyor motor using OTL/OTU rather than a seal-in. This mirrors a common pattern in larger programs where fault handling and production control live in separate routines.

(* Production Routine — Rung 0010 *)
(* Start conditions: Start PB pressed AND no active fault *)

| Start_PB  Fault_Active                                    |
|---[ ]---+---[/]---+------------------------------(OTL Conveyor_Run)
|         |         |
| Auto_Mode|         |
|---[ ]---+         |
           |         |
           +---------+

(* Rung 0020 *)
(* Unlock: Stop PB OR fault detected OR e-stop *)

| Stop_PB                                                   |
|---[ ]---+--------------------------------------------(OTU Conveyor_Run)
|         |
| Fault_Active                                              |
|---[ ]---+
|         |
| EStop_HW                                                  |
|---[ ]---+

(* Output Rung — lives in I/O Routine *)
(* Drive the physical output only when run flag is set      *)
(* AND all permissives are healthy                          *)

| Conveyor_Run  EStop_HW  Overload_Trip                     |
|---[ ]---+---[/]---+---[/]---+--(OTE Conveyor_Starter_Out) |

Key points in this structure:

  • Conveyor_Run is the latched state bit — it is never wired directly to a physical output.
  • The physical output coil (Conveyor_Starter_Out) re-evaluates permissives every scan via a separate OTE rung. Even if Conveyor_Run is latched ON, a tripped overload or hardware E-stop drops the physical output immediately.
  • The OTU rung has three independent paths that can reset the run bit, keeping reset logic centralized and readable.
  • This pattern also makes it straightforward to add a one-shot rising edge to the start condition if you want to prevent the conveyor from re-starting while the start button is held continuously.

For reference on the basic ladder logic symbols used in these rungs, including contacts, coils, and function blocks, see the dedicated symbols guide.

IEC 61131-3 SR Set-dominant and RS Reset-dominant function block behavior comparison Side-by-side comparison of the IEC SR and RS function blocks showing that SR gives priority to the Set input when both inputs are simultaneously true, while RS gives priority to the Reset input. SR — Set-Dominant Block SR IEC 61131-3 S R1 Q1 S=1, R1=0 → Q1 = 1 (set) S=0, R1=1 → Q1 = 0 (reset) S=1, R1=1 → Q1 = 1 (S wins) Set has priority when both active Use: alarm latches, run flags RS — Reset-Dominant Block RS IEC 61131-3 S1 R Q1 S1=1, R=0 → Q1 = 1 (set) S1=0, R=1 → Q1 = 0 (reset) S1=1, R=1 → Q1 = 0 (R wins) Reset has priority when both active Use: safety outputs, E-stop latches
IEC 61131-3 SR vs RS function blocks: SR is set-dominant (S wins simultaneous conflict), RS is reset-dominant (R wins). Prefer RS for safety-related outputs where simultaneous set+reset should default to the safe OFF state.

When to Use Latch vs Seal-In — Decision Guide

Use a seal-in rung when:

  • The output drives a motor, valve, or actuator that must not restart automatically after a power interruption.
  • The start/stop logic can be expressed in a single self-contained rung.
  • You are working in a safety-critical context where the fail-safe state is OFF.
  • The program is simple enough that one rung per output is maintainable.

Use OTL/OTU (set/reset) when:

  • Multiple independent conditions can set or reset the bit and encoding them all into one rung creates an unreadable mess.
  • The bit is a status flag (alarm active, fault latched, recipe selected) rather than a direct output driver.
  • Set and reset logic belong to logically separate routines or tasks.
  • You are implementing a state machine where state variables need to persist independently of the conditions that triggered the transition.
  • You need the bit to survive power cycles (with a controlled, supervised restart procedure).

A practical rule of thumb: control physical outputs with seal-in rungs or equivalent permissive-gated OTE rungs. Use latched bits for program logic and status tracking. When a latched bit does control an output path, always add a separate OTE rung with live permissives so the physical output can be dropped by hardwired interlocks even if the latch bit remains set.


Frequently Asked Questions

What is the difference between latch and unlatch in a PLC?

A latch instruction (OTL or Set) forces a bit ON and keeps it ON even after the enabling condition goes FALSE. An unlatch instruction (OTU or Reset) forces that same bit OFF and keeps it OFF until the latch fires again. Unlike a normal output coil, the bit does not follow its rung condition — it retains the last state written to it.

What is OTL and OTU?

OTL stands for Output Latch and OTU stands for Output Unlatch. These are Allen-Bradley / Rockwell Automation instruction mnemonics used in ladder logic. Other vendors use different names for the same concept: Siemens uses S (Set) and R (Reset) coils; Mitsubishi uses SET and RST instructions; Omron uses SET and RSET. All perform the same function — retaining a bit state independently of the enabling rung condition.

Is a latch bit retentive on power loss?

On most Allen-Bradley ControlLogix and CompactLogix platforms, yes — the output image table is saved to battery-backed SRAM and restored on power-up, so a latched bit comes back in whatever state it was in before the outage. This behavior varies by platform and can be a safety hazard if a latched output controls a motor or actuator. Always verify your platform's retentivity behavior and use a controlled restart procedure when latched bits are present.

Latch or seal-in — which is better?

Neither is universally better; they solve different problems. A seal-in rung is simpler, self-contained, and inherently fails to OFF on power loss, making it the right choice for most motor-control outputs. OTL/OTU is better when multiple conditions contribute to set/reset, when logic is spread across routines, or when you need a status flag that persists. For safety-critical outputs, the seal-in approach (or hardwired safety relays) is strongly preferred because it requires an active restart command rather than relying on retained state.

#latchunlatch#OTL#OTU#setreset#ladderlogic#retentive
Share this article:

Related Articles