LadderLogicOnline

Learn › Instructions

OTL and OTU: Latch and Unlatch

OTL turns a bit on and leaves it on. OTU turns the same bit off. Together they give you set/reset logic: one rung decides when something starts, another decides when it stops.

What they do

Both are output instructions, so they sit in the last column of a rung, just like an OTE coil. The difference is what happens when the rung goes false.

InstructionRung trueRung false
OTE Output EnergizeBit = 1Bit = 0
OTL Output LatchBit = 1Does nothing (bit keeps its value)
OTU Output UnlatchBit = 0Does nothing (bit keeps its value)

An OTE follows its rung every scan. OTL and OTU only act while their rung is true and are silent otherwise. That's what makes the bit "remember": once an OTL has turned it on, nothing changes it again until an OTU with the same tag sees a true rung.

A basic latch and unlatch

Here's a motor started by one push button and stopped by another, using a latch instead of a seal-in circuit:

 |   Start                                   Motor   |
 |----] [------------------------------------(L)----|
 |                                                  |
 |   Stop                                    Motor   |
 |----] [------------------------------------(U)----|
Rung 0 latches Motor on when Start is pressed. Rung 1 unlatches it when Stop is pressed.

Press Start for a single scan and Motor turns on. Let go and rung 0 goes false, but OTL does nothing on a false rung, so Motor stays on. Press Stop and rung 1 turns Motor off. Let go, and again nothing changes it.

Notice that Stop uses an XIC here, not an XIO. The OTU should act when the stop button is pressed, so the rung needs to be true while it's pressed. If you're used to seal-in circuits, where the stop button is usually an XIO, this is an easy one to get backwards. The XIC and XIO lesson explains why.

What if both rungs are true?

If someone holds Start and Stop at the same time, both rungs are true in the same scan. The PLC solves rungs top to bottom, so the OTL turns Motor on and then the OTU turns it off a moment later. The last rung to write the bit wins, and the outputs see Motor off at the end of the scan.

That means rung order is how you choose which command has priority. Put the OTU below the OTL and stop wins, which is what you almost always want for anything that moves. If you put the unlatch first, start would win, which is rarely safe. See how the scan cycle works for more on why order matters.

Latch or seal-in?

A seal-in circuit does the same job as a latch/unlatch pair using an ordinary OTE and a contact that holds the rung true. Both work, so which should you use?

A practical example: latching a fault

Faults are the classic use for OTL. Say a photo eye at the end of a conveyor should never stay blocked for long. A TON timer watches for a jam, and an OTL remembers it even after the box is cleared, so the operator has to acknowledge it.

 |   PE_End                                          |
 |----] [------------------------------[TON  JamT  PRE 3.0s]--|
 |                                                  |
 |   JamT.DN                                  Jam    |
 |----] [------------------------------------(L)----|
 |                                                  |
 |   Reset        PE_End                     Jam    |
 |----] [---------]/[------------------------(U)----|
 |                                                  |
 |   Run          Jam                     Conveyor   |
 |----] [---------]/[------------------------( )----|
A jam latches on after 3 seconds of blocked eye. Reset only clears it once the eye is clear.

The reset rung includes XIO PE_End, so pressing Reset while the box is still stuck does nothing. That small detail stops the operator from clearing a fault that's still there.

Try it in the Playground

  1. Open the Playground and pick the conveyor scene. Add two push buttons and name their tags Start and Stop.
  2. Build rung 0: XIC Start then OTL Motor. Build rung 1: XIC Stop then OTU Motor.
  3. Set the conveyor's Forward bit to Motor, press Run, and tap Start. The conveyor keeps running after you let go.
  4. Hold both buttons together. Stop wins because its rung is lower. Now drag rung 1 above rung 0 and try again to see start win instead.

Common mistakes