Book a consultation

PLC Programming

OTL Instruction (Output Latch): How a PLC Latch Really Works

The OTL instruction sets a bit and leaves it set. Latched bits through prescan and a power cycle, OTL vs a seal-in, and 16 vendor editors.

Vladimir Romanov ·


Table of contents13 sections

The OTL instruction is the simplest way to make a PLC remember something, and the easiest way to make a machine do something nobody asked for. Output Latch sets a bit and walks away: when its rung goes false, it does nothing, so the bit stays 1. That one behaviour is why OTL is perfect for a fault that must wait for an operator, and why it is dangerous on an output that drives a motor. Most tutorials stop at “latch turns it on, unlatch turns it off”. This page goes further: what a latched bit does when the rung goes false, through prescan, and through a power cycle, and how to choose between a latch and a seal-in.

Clearing the latch is the other half of the design, and it gets its own page: OTU, Output Unlatch. As with the other instruction pages in this guide, there is a quiz and five harder problems at the end, and every animation has a pause control.

The short version. OTL writes 1 to its bit while its rung is true and does nothing when the rung is false, so the bit stays 1 until something else clears it. Prescan does not clear it either. Use a latch for memory that must outlast its cause, decide what clears it, and decide what the machine does when the latched state is still there at start-up.

What is the OTL instruction?

The OTL instruction, short for Output Latch, is a ladder logic output instruction that sets one bit. When its rung is true, OTL writes 1 to the bit. When its rung is false, it leaves the bit alone. The bit stays 1 until another instruction clears it, normally an OTU on the same bit. Other vendors call it a set coil or a SET instruction.

Animation of a jam photo-eye input, a rung with an XIC on Jam_Detected driving an OTL on Jam_Latched, and a jam beacon that stays on after the jam clears.
A carton blocks the jam eye and the OTL latches Jam_Latched. When the carton is pulled clear the rung goes false, but the OTL does nothing, so the bit and the jam beacon stay on until a reset clears them. Download the GIF

Rockwell’s Logix 5000 general instructions reference manual (publication 1756-RM003) gives OTL one BOOL operand, the bit to be set, and this execution table:

Condition when the OTL executesWhat happens to the bitRung condition out
Prescan (when the controller enters Run mode)Not modifiedFalse
Rung condition coming in is falseNot modifiedFalse
Rung condition coming in is trueSet to 1True
PostscanNot modifiedFalse

Source: Rockwell Automation, Logix 5000 Controllers General Instructions Reference Manual, 1756-RM003, revision P, OTL section.

Compare it with the OTE table, which clears the bit in three rows out of four. OTL clears it in none. The manual adds that OTL does not affect the arithmetic status flags, has no fault conditions, and exists in relay ladder only. In structured text the equivalent is a conditional assignment, IF Jam_Detected THEN Jam_Latched := 1; END_IF;.

What changes a latched bit, and what does not?

Once an OTL has set its bit, very little changes it. The rung going false does not, prescan does not, and the cause going away does not. An OTU, another instruction or an HMI write that puts 0 in the bit does. A power cycle and a program download are the two events that depend on your controller and your settings, so they are worth testing rather than assuming.

What changes a latched bit, and what does notSix cards. Green cards are events that do not change a bit written by OTL: the rung going false, the controller passing through prescan when it enters Run, and an SFC postscan. Amber cards are events that do change it or need checking: an OTU or other writer clears it; a power cycle keeps it on an SLC 500 according to Rockwell's manual, and on other controllers it depends on how memory is retained, so it must be tested; and a download replaces tag values unless the download preserves them.JAM_LATCHED = 1. THEN...The rung goes falseOTL does nothing.The bit stays 1.Prescan (entering Run)OTL does nothing in prescan.The bit comes through unchanged.An OTU, MOV or HMI writes 0The only things that clear it.Find them with a cross reference.A power cycleSLC 500: the bit is kept (manual).Other controllers: test yours.A program downloadDepends on the controllerand the download options. Test it.The cause goes awayNothing happens to the bit.That is the point of a latch.
A latched bit survives almost everything except a deliberate clear. The two amber events are the ones to test on your own controller before you rely on them.

That is the whole value of a latch: it is memory that outlasts its cause. A jam that lasted a quarter of a second is still visible to the operator who arrives a minute later. A batch step that finished stays finished while the next step runs.

A chrome key switch on a worn machine panel with the key hanging above it
A key switch is a mechanical latch: it stays where you left it. An OTL does the same to a bit, and the program needs a deliberate way to turn it back.

Rockwell’s SLC 500 instruction set reference manual (1747-RM001) calls OTL and OTU “retentive output instructions”, says OTL can only turn a bit on and OTU only turn it off, and says they are usually used in pairs addressing the same bit. When an OTL addresses a physical output, the output stays energised after the rung goes false, until an OTU de-energises it. That is exactly the behaviour that needs thought on anything that moves.

Does a latched output stay on after a power failure?

It can, and that is the risk. OTL only sets the bit; what happens to it through a power loss depends on the controller’s memory. Rockwell’s SLC 500 manual (1747-RM001, revision C) says OTL and OTU retain their state through a power cycle, so a latched output can come back on when power returns. On other controllers, test it rather than assume it.

Animation of an SLC 500 rung with XIC I:1/0 driving OTL O:2/0, a power badge going off and on, and a conveyor motor that restarts by itself when power returns.
Start latches O:2/0 and the conveyor runs. Power fails and the motor stops, but the SLC 500 keeps the bit at 1. When power returns, nobody presses Start, yet the conveyor restarts on its own. Download the GIF

The SLC 500 manual has a closely related warning. For hold-in rungs on the retentive outputs of specialty I/O modules, it says the rung can cause unexpected start-up at power-up, and its fix is to unlatch those outputs on the first program scan using the first pass bit, S:1/15. The same fix applies to any latched run bit. Logix controllers have the equivalent first-scan bit, S:FS; test on your controller whether it also fires when you switch from Program to Run, not only at power-up. The OTU page shows that first-scan pattern in detail.

The machinery standard behind this is ISO 14118, Safety of machinery: Prevention of unexpected start-up, which requires the risk of unexpected start-up on restoration of power to be considered and, where necessary, prevented. A latched run command that survives a power loss is one way such a restart can happen, so I treat it as a case to design for. The rule I use is simple: never latch a command that makes equipment move unless something deliberately decides, at power-up, whether that command should still be there.

On Logix controllers there are two more things to check rather than assume. First, how your controller retains memory through a power loss: it depends on the controller family and its memory backup. Second, what the output modules do while the controller is in Program mode or faulted: 1756 digital output modules can be configured, per point and separately for Program mode and Fault mode, to turn their points off, turn them on, or hold their last state (check the module’s configuration in your version of the software). Both decide whether a latched output reaches the field at the moment power comes back.

OTL vs OTE and the seal-in: which should you use?

An OTE with a seal-in branch and an OTL/OTU pair can both keep a motor running after Start is released. The difference is what happens on a restart. The seal-in forgets: prescan clears its OTE, and the motor waits for Start. The latch remembers: prescan leaves it alone, and the motor carries on as soon as the program runs.

Animation of a seal-in rung on Motor_A and an OTL rung on Motor_B passing through prescan, with a mode strip and a tag table showing that only the latched motor keeps its 1.
Both motors were running. Going through Program and back to Run, prescan clears the seal-in's OTE but leaves the OTL alone, so Motor_A waits for Start while Motor_B is already running. Download the GIF
OTE with a seal-inOTL with an OTU
Keeps the bit on after Start is releasedYes, through its own branchYes, because OTL does nothing on a false rung
Drops out when a permissive is lostYes, by itselfOnly if an OTU or another writer clears it
After prescan (entering Run)Cleared: waits for StartUnchanged: carries on
After a power cycleCleared when the program restartsKept, if the controller retains memory (SLC 500: yes)
Where the logic livesOne rungAt least two rungs, often far apart
Best forEquipment that moves: motors, valves, heatersMemory: faults, first-out alarms, sequence flags, batch records

That is why I, and most programmers I have worked with, seal in anything that drives equipment, and keep latches for things that must be remembered. A latched motor run bit is not wrong in itself, but it makes every stop and every start-up something you have to design rather than something that happens by default.

How does an OTL behave over time? Level, not edge

OTL is level-sensitive. It writes 1 on every scan while its rung is true, not once on a rising edge. Writing 1 to a bit that is already 1 changes nothing, so most of the time a latch looks edge-triggered. The difference shows when something tries to clear the bit while the OTL rung is still true: the OTL sets it again on the next scan.

Animation of a timing chart with four traces: rung condition, OTE bit, OTL bit and OTU rung, with a cursor stepping across twelve scans.
A timing chart of one rung condition driving an OTE bit and an OTL bit. The OTE follows the rung; the OTL bit goes to 1 on the first true pulse and stays there until an OTU elsewhere clears it. Download the GIF

Two practical consequences:

  • A latch cannot be held cleared while its cause is still there. If the OTL rung is true, an OTU on the same bit clears it only until the OTL runs again. Which one ends the scan on top depends on rung order within the task; order across tasks is not guaranteed. The OTU page covers set-dominant and reset-dominant designs.
  • One-time actions need a one-shot. If you want to count a jam, or log it once, a latch alone will not give you a single event. Put a one-shot (ONS) on the rung for the event, and keep the latch for the state.

When does an OTL write? Prescan and a stale latch

OTL writes only when it executes with a true rung. During prescan, when the controller enters Run mode, Rockwell’s execution table says the bit is not modified. So a latched bit always comes through a mode change with whatever value it had before.

Animation of a mode strip passing from Program through prescan to Run, with a latched fault bit unchanged and an OTE permit cleared, and the heater still blocked on the first scan.
Yesterday's overtemperature latched Overtemp_Flt. On the way into Run, prescan clears the OTE Heater_Permit but leaves the latched fault alone, so on the first scan the heater stays blocked until someone resets the fault. Download the GIF

For a fault, that is usually exactly right. A trip that happened before the controller went to Program mode should still be a trip when it comes back, and someone should look at it before the heater is allowed to run. For a run command it is usually wrong, for the reasons in the power-cycle section above. The design question for every latch is the same: when the controller next enters Run, should this bit still be 1? If not, clear it on the first scan.

OTL in practice: seven scenarios from simple to advanced

Each scenario shows a rung in a particular state, why OTL is the right instruction, and what goes wrong. Tag names are examples, written the way I would want them in a real program.

1. Packaging: latch a short fault so it is seen

A pressure-sensitive labeler stops when its label web breaks. The loose end flaps past the web-break sensor, so the signal lasts only a moment.

Animation of a web-break rung with an OTL on Web_Break_Flt and a labeler run rung with an XIO on the same bit, with a labeler drive and a fault beacon.
The label web snaps and Web_Break is 1 for only a moment. The OTL has already latched Web_Break_Flt, so the labeler stays stopped and the fault beacon stays on after the sensor reads 0 again. Download the GIF

Why OTL: the signal is shorter than the operator’s reaction time, and the labeler must not restart with no labels. The latch turns a momentary event into a state that waits for a person. What goes wrong: no reset path. A latch with no OTU, or with an OTU on an HMI button that nobody wired up, leaves the labeler stopped until someone goes online. Write the reset rung at the same time as the latch.

2. Bottling: latch the first fault that stopped the machine

When a filler stops, several faults often follow the first one: a guard opens, the conveyor backs up, a low-air alarm trips as the cylinders bleed down. Operators need to know which came first. A first-out scheme latches the first fault and blocks all the others.

Packaging: latch the first fault that stopped the machineTwo rungs. Rung 30: XIC Guard_Open_Flt and XIO First_Out_Taken drive an OTL on First_Out_Guard. Rung 31: XIC Any_Fault drives an OTL on First_Out_Taken. In the state shown, the scan after the guard fault: First_Out_Guard latched on the previous scan and First_Out_Taken is now 1, so its XIO blocks rung 30 and every other first-out rung.Guard_Open_FltXIC= 1First_Out_TakenXIO= 1LFirst_Out_GuardOTL30Any_FaultXIC= 1LFirst_Out_TakenOTL31
The guard fault came first, so First_Out_Guard latched. Rung 31 then latches First_Out_Taken, and its XIO on every first-out rung blocks the faults that follow.

Why OTL: the first-out record must survive the cascade that follows it, and every later fault must be prevented from overwriting it. Problem 3 below shows the version that is safe within one scan. What goes wrong: rung order and scan timing. Two faults that arrive in the same scan both see First_Out_Taken at 0, so both latch. Some first-out schemes accept that and show both, or they put the fault rungs in priority order and set First_Out_Taken immediately after each one. And the whole set needs one reset rung that clears every first-out bit together.

3. Water and wastewater: latch a pump that failed to start

A booster station calls pump 2. If its run feedback has not arrived within a few seconds, the pump has failed to start, and the station should switch to the standby pump and keep it there until someone checks pump 2.

Water and wastewater: latch a pump that failed to startOne rung. XIC P2_Call and XIC P2_No_Run_Tmr.DN drive an OTL on P2_Fail_Start. In the state shown the pump was called but its run feedback did not arrive before the timer finished, so the failure is latched and the station switches to the other pump.P2_CallXIC= 1P2_No_Run_Tmr.DNXIC= 1LP2_Fail_StartOTL18
Pump 2 was called but its run feedback did not arrive before the timer finished, so the failure is latched and the station uses the other pump.

Why OTL: without the latch, the timer resets as soon as the call drops, pump 2 becomes available again, and the station tries the broken pump on every cycle. What goes wrong: latching the failure but never showing it. A latched pump fault that only exists inside the PLC looks to operators like a station that “prefers” pump 1. Every latch that changes how a plant behaves belongs on the HMI with a reset.

4. Chemicals: a high-high trip that stays tripped

A batch tank has a high-high level switch above its normal high level. If the level ever reaches it, the fill must stop and stay stopped until someone has checked why.

Animation of a batch tank filling to a high-high switch, a rung with XIC LSHH_101 driving an OTL on HH_Trip, and a fill rung with an XIO on HH_Trip that keeps the inlet valve closed after the switch clears.
The level reaches the high-high switch and the OTL latches HH_Trip, which closes the inlet through an XIO. When the tank is drawn down and the switch goes dry, the trip stays latched and the inlet stays closed. Download the GIF

The animation assumes the switch reads 1 in alarm; a high-high switch is often wired fail-safe, and then the rung reads it with XIO. Why OTL: a trip that clears itself as soon as the level drops lets the tank cycle around the switch, filling and stopping, and nobody finds out why. What goes wrong: treating this latch as the overflow protection. A high-high trip on a tank whose overflow could hurt someone or the environment belongs to an independent layer with its own switch and final element, often a safety instrumented function. The PLC latch is the control system’s record of the event.

5. Food and beverage: latch “clean verified” after an allergen changeover

After an allergen changeover, the line may not start the next product until a swab test has passed and quality has signed off. The verification must persist until the next changeover begins.

Food and beverage: latch "clean verified" after an allergen changeoverOne rung. XIC Swab_OK, XIC QA_OK and XIC Changeover_Active drive an OTL on Clean_Verified. Swab_OK and QA_OK are themselves latched on their own rungs when the swab test passes and when QA signs off. In the state shown both are in, so the line is marked clean and may start the next product.Swab_OKXIC= 1QA_OKXIC= 1Changeover_ActiveXIC= 1LClean_VerifiedOTL4
The swab result and the QA sign-off were each latched when they happened, so both are 1 and Clean_Verified latches. Production rungs read it with an XIC.

Why OTL: the swab result and the sign-off are momentary events that happen at different times, so each is latched on its own rung (Swab_OK and QA_OK) while the changeover is active, and this rung latches the verification once both are in. The permission must last the whole production run. What goes wrong: the reset. Clean_Verified, Swab_OK and QA_OK must all be cleared together on the edge of the next changeover starting, and it must not survive a download or a recipe change that could put a new product on a line verified for the old one. This is exactly the kind of latch that also needs a record outside the PLC, in the batch or quality system.

6. Pharmaceutical: latch each completed batch step

A granulation sequence records each step as it completes, so the batch record and the sequence logic both know where the batch is.

Pharmaceutical: latch each completed batch stepOne rung. XIC Step_Granulate_Active and XIC Granulate_Endpoint drive an OTL on Granulate_Done. In the state shown the granulation endpoint was reached, so the step is recorded as done and the sequence may move on.Step_Granulate_ActiveXIC= 1Granulate_EndpointXIC= 1LGranulate_DoneOTL12
The granulation endpoint was reached during the granulate step, so Granulate_Done is latched and the sequence may move on.

Why OTL: each step’s completion must stay true while later steps run, and the sequence reads the done flags to decide what comes next. What goes wrong: last batch’s flags. If the step-done bits are not cleared when a new batch starts, the sequence can skip a step it thinks is already done. The OTU page animates the batch-start reset. In a validated process this logic usually lives in an ISA-88 style batch system, but the latch-and-clear pattern is the same.

7. Automotive: latch a bad part so it is rejected downstream

A nut runner reports torque in or out of specification. A part that fails must be rejected at the next station, so the failure is latched into the part’s tracking data.

Automotive: latch a bad part so it is rejected downstreamOne rung. XIC Torque_Check_Done and XIO Torque_In_Spec drive an OTL on Part_Reject. In the state shown the nut runner finished but the torque was out of specification, so the part is marked for rejection.Torque_Check_DoneXIC= 1Torque_In_SpecXIO= 0LPart_RejectOTL7
The nut runner finished but the torque was out of specification, so Part_Reject is latched for this part.

Why OTL: the torque result is a short pulse or a message the program must catch; the reject decision must travel with the part. What goes wrong: a latch on a single bit when the line holds several parts. When the next part arrives, Part_Reject is still 1 from the last one. Part tracking needs the result stored per part, in a shift register or an array indexed by position, and the latch cleared as each part’s data moves on.

What does OTL look like in each vendor’s software?

Every ladder editor has a latch, under several names. Rockwell Automation calls it OTL in Studio 5000 Logix Designer and RSLogix 500, and draws it as a coil with an L (more on those platforms on our Rockwell Automation page). Siemens calls it a set output, and CODESYS, Phoenix Contact and AutomationDirect call it a set coil, drawn with an S or the word SET. Mitsubishi Electric uses the SET instruction, and Omron uses SET or the KEEP instruction.

The same latch across six programming environmentsA table of six rows. Rockwell Automation calls the instruction OTL, Output Latch, drawn as a coil with an L, in Studio 5000 Logix Designer and RSLogix 500. Siemens TIA Portal and CODESYS call it a set coil, drawn with an S. Mitsubishi Electric uses the SET instruction and AutomationDirect CLICK a Set coil. Each row shows an example operand and the text form.VENDOR AND SOFTWARELADDERTEXT FORMRockwell AutomationStudio 5000 Logix DesignerOTL, Output LatchJam_LatchedLOTL(Jam_Latched)Rockwell AutomationRSLogix 500 (SLC 500, MicroLogix)OTL, Output LatchB3:0/4LOTL B3:0/4SiemensTIA Portal (S7-1500)Set output"Jam_Latched"SSTL: S "Jam_Latched"Mitsubishi ElectricGX Works3 (MELSEC iQ-R)SET instruction / set coilM10SSET M10IEC 61131-3 / CODESYSCODESYS-based softwareSet coilbJamLatchedSST: IF c THEN x := TRUE;AutomationDirectCLICK Programming SoftwareSet coilC10SLadder only
The same latch in six notations. Rockwell writes an L inside the coil; most other vendors write an S.
VendorSoftwareName of the instructionExample operandText form
Rockwell AutomationStudio 5000 Logix DesignerOTL, Output LatchJam_LatchedRung text OTL(Jam_Latched); ST IF c THEN Jam_Latched := 1; END_IF;
Rockwell AutomationRSLogix 500 (SLC 500, MicroLogix)OTL, Output LatchB3:0/4, O:2/0OTL B3:0/4
SiemensTIA Portal (S7-1500)Set output"Jam_Latched", %M10.0STL S "Jam_Latched"
Mitsubishi ElectricGX Works3 (MELSEC iQ-R)SET instructionM10, Y20SET M10
IEC 61131-3 / CODESYS, BeckhoffCODESYS, TwinCAT 3Set coilA named BOOL variableST IF c THEN bJam := TRUE; END_IF;
Phoenix ContactPLCnext EngineerSet coilA named BOOL variableST conditional assignment
AutomationDirectCLICK Programming SoftwareSet coilC10, Y001None; ladder only

Sources: Rockwell Automation 1756-RM003 and 1747-RM001; Siemens STL for S7-1500 (S and R); Mitsubishi Electric FA FAQ 22456; CODESYS and Beckhoff online help; Phoenix Contact PLCnext Engineer help; AutomationDirect CLICK help.

The same latch in each vendor’s editor

These are real screenshots of the latch in 16 programming environments, ordered the same way as on the other instruction pages. Each one is framed the same way, with the latch ringed in amber and the source credited under it. Pick a tab to switch software.

VendorSoftwareWhy it is not shown yet
SiemensLOGO!Soft ComfortWe found no set coil in LOGO! ladder in the V8.4 help; latching is done with the RS latching relay block.
OmronSysmac StudioNo public screenshot of a SET coil in the editor; the manual shows drawn symbols only.
AutomationDirectDo-more DesignerNo public screenshot of a SET instruction in the editor.
Mitsubishi ElectricGX Works3, GX Works2The training manuals show SET as a drawn figure, not an editor window.
Schneider ElectricEcoStruxure Control ExpertThe manual’s LD chapter shows only drawn symbols. Machine Expert and Machine Expert - Basic are shown above.
EmersonPAC Machine EditionThe only set coil figure found is too small to frame legibly.
Phoenix ContactPLCnext EngineerNo public screenshot of a set coil in the editor.
KEYENCE, B&R, InovanceKV STUDIO, Automation Studio, InoProShopNo public screenshots of the ladder editors (see the XIC page for the search trail).

If you work in one of these, the instruction is the same latch; we will add your editor when we capture it ourselves.

Two platform differences are worth knowing. Mitsubishi Electric’s GX Works3 has a duplicated-coil check, and its own FAQ notes that SET and RST on one device are not flagged, because that pair is meant to share a device. And several platforms offer a bistable function block (SR or RS) as an alternative to a pair of coils. The block names do not mean the same thing everywhere, which the OTU page explains.

Why did my latch turn on by itself, or never turn off? A debugging checklist

Most latch problems are one of two complaints: something is on that nobody turned on, or something will not turn off. Both come from the bit’s history, not its current rung.

  1. Cross-reference the bit. List every OTL, OTU, OTE, MOV, COP and HMI tag that writes it. A latch has at least two writers by design; anything beyond the expected pair is suspect.
  2. For “won’t turn off”, check the OTL rung. If the OTL’s rung is still true, the bit is set again every scan, and an OTU only clears it until the OTL runs. Fix the cause, or make the reset wait for it.
  3. Check the OTU rung’s conditions. Is the reset button wired, mapped and actually reaching the bit? Is the OTU rung in a routine that is being scanned?
  4. For “turned on by itself”, think about history. Was the controller power-cycled, downloaded, or switched to Run since the bit was last cleared? A latched bit comes through all of those unless something clears it at start-up.
  5. Check the first-scan logic. If there is a first-scan clear, confirm it runs: it must be in a routine scanned on the first scan, and it must use the right bit (S:FS in Logix, S:1/15 on an SLC 500).
  6. Check the output module configuration. A latched output tag only reaches the field through the module. Check how the module is set to behave in Program mode and on a fault.
  7. Look for forces and online edits. A forced bit or a recently edited rung explains “it changed while nobody was near it” more often than anything else.

A latch’s behaviour depends on events that happened before you went online, which is why latches deserve rung comments that say what sets them, what clears them, and what should happen at start-up.

Common OTL mistakes

MistakeWhat happensFix
Latching a run command for equipmentThe equipment restarts after a mode change or power cycleUse a seal-in, or clear the latch on the first scan
No reset pathThe latch can only be cleared by going onlineWrite the OTU rung at the same time as the OTL
Expecting the OTU to win while the cause is presentThe bit flickers or never clearsDecide which side dominates; reset only when the cause is gone
OTL and OTE on the same bitThe OTE writes 0 whenever its rung is false and erases the latchOne approach per bit
One latch bit shared by several parts or batchesThe next part or batch inherits the last one’s stateStore state per part or per batch, and clear it as data moves
Driving a counter, log or move from the OTL rungIt runs on every scan the rung is trueOne-shot for the event, latch for the state
Treating a latched trip as the protection layerProtection depends on standard logicIndependent safety layer; the latch is the record

Test yourself: an interview quiz on OTL

Ten questions, the kind I'd ask in an interview for a controls role to see whether someone really understands OTL. Pick an answer and the explanation appears straight away.

0 of 10 answered

  1. What does an OTL do when its rung is false?

  2. What happens to a latched bit during prescan, when the controller enters Run?

  3. Is OTL edge-triggered?

  4. On an SLC 500, a latched output was on when power failed. What happens when power returns?

  5. What is the Logix first-scan bit you would use to clear latches at start-up?

  6. A motor is run by an OTL and stopped by an OTU. Compared with a seal-in circuit, what happens after the controller goes from Program to Run?

  7. An OTL rung is still true and an operator presses Reset, which drives an OTU on the same bit in the same routine. What decides the bit's value at the end of the scan?

  8. What is the structured text equivalent of OTL(Fault_Mem) on a rung with condition c?

  9. Which of these is the best use of OTL?

  10. What does Siemens TIA Portal call the OTL equivalent in LAD?

Five harder OTL problems

These are commissioning-grade problems. Try each on paper before opening the solution. The rungs are written in Logix rung text: XIC(tag) and XIO(tag) are contacts, square brackets with commas are parallel branches, and OTE, OTL and OTU are the output instructions.

Problem 1: the conveyor that restarts after a power dip

An SLC 500 line that still runs its original program starts its conveyors with XIC(Start_PB) OTL(Conv1_Run) and stops them with XIC(Stop_PB) OTU(Conv1_Run), using a normally open stop button. After a short power dip last week, three conveyors restarted on their own and jammed the transfer. Explain why, then give two fixes, one that keeps the latch and one that does not.

Show the solution

The run bits were latched when power dropped. The SLC 500 keeps latched bits through a power cycle, and Rockwell’s manual says so, so when the program started again Conv1_Run was still 1 and the outputs came back on. Nothing in the logic asked whether the conveyors should restart. (The normally open stop button is a second problem: a broken stop wire looks exactly like “not pressed”, so Stop stops working.)

Keep the latch, but clear it at start-up with the SLC 500 first pass bit and fix the stop:

XIC(S:1/15) OTU(Conv1_Run);
XIC(Start_PB) OTL(Conv1_Run);
XIO(Stop_PB_NC) OTU(Conv1_Run);

with the stop button rewired normally closed as Stop_PB_NC, so pressing it or breaking its wire makes the bit 0 and the OTU fires. (On a Logix controller the first-scan bit is S:FS.) Or drop the latch, which is what I would do for a conveyor:

XIC(Stop_PB_NC) [XIC(Start_PB) ,XIC(Conv1_Run) ] OTE(Conv1_Run);

The seal-in is cleared by prescan and needs Start after any restart, with no extra rung to remember.

Problem 2: a fault that will not reset

A packaging machine latches Air_Low_Flt with XIC(Air_Pressure_Low) OTL(Air_Low_Flt) and resets it with XIC(Reset_PB) OTU(Air_Low_Flt) on the rung directly below. The air supply was repaired, but an operator says Reset only clears the fault lamp while the button is held; on release the fault comes straight back. What is happening, and what is the right design?

Show the solution

The symptom says the OTU is working and something sets the bit again. If Air_Pressure_Low is still 1, the OTL rung sets the bit on every scan and the OTU below clears it, so for almost the whole scan the bit is 0 and the lamp looks cleared. Release Reset and the OTL’s 1 is the only write left. So the air is not actually back to normal as far as the controller is concerned. Check the pressure switch, its setpoint and its input before touching the logic.

The right design makes the behaviour explicit: the reset only works once the cause has gone, and the operator can see why it did not.

XIC(Air_Pressure_Low) OTL(Air_Low_Flt);
XIC(Reset_PB) XIO(Air_Pressure_Low) OTU(Air_Low_Flt);
XIC(Air_Low_Flt) XIC(Air_Pressure_Low) OTE(Air_Low_Still_Active);

The third rung gives the HMI a separate “still active” indication, so “Reset does nothing” becomes “the alarm is still active”. The OTU page animates this case.

Problem 3: first-out with two faults in the same scan

A first-out scheme has, for each fault n, XIC(Fault_n) XIO(First_Out_Taken) OTL(First_Out_n), and after all of them XIC(Any_Fault) OTL(First_Out_Taken). During commissioning, an emergency stop that dropped a safety relay showed three first-out lamps at once. Explain why, and propose a fix that gives exactly one first-out.

Show the solution

The safety relay dropping made three fault bits go to 1 in the same scan. Each first-out rung runs before the rung that sets First_Out_Taken, so all three see it at 0 and all three latch.

Set the “taken” bit inside each first-out rung, so the first fault in rung order blocks the rest in the same scan:

XIC(Fault_1) XIO(First_Out_Taken) [OTL(First_Out_1) ,OTL(First_Out_Taken) ];
XIC(Fault_2) XIO(First_Out_Taken) [OTL(First_Out_2) ,OTL(First_Out_Taken) ];

Now the first rung that sees a fault takes the first-out and every rung after it sees First_Out_Taken at 1. Ties within one scan go to the fault earliest in the routine, so put the faults in the order you would most want reported. Be honest about the limit: faults that truly arrive in the same scan cannot be ordered by a scan-based program. For finer resolution, use event tasks or time-stamped inputs. And make the reset clear every first-out bit and First_Out_Taken together, gated with XIO(Any_Fault) so a reset cannot re-latch on a fault that is still there.

Problem 4: last batch’s step flags

A mixing sequence latches Mix_Done, Heat_Done and Cool_Done as each step completes and advances when the previous step’s flag is 1. After a batch was aborted during heating and a new batch was started, the sequence skipped the mixing step and went straight to heating. Explain and fix.

Show the solution

Mix_Done was latched by the aborted batch and nothing cleared it. The new batch’s sequence saw the mix step as already done and moved on; depending on the logic it may also have seen stale values for other steps. Latched flags are memory, and memory from the last batch is the wrong memory for this one.

Clear every step flag at the start of each batch, before any step can read them:

XIC(Batch_Start) ONS(Batch_Start_ONS) [OTU(Mix_Done) ,OTU(Heat_Done) ,OTU(Cool_Done) ];

and put this rung above the sequence rungs. Also clear them when a batch is aborted, so an operator looking at the HMI after an abort sees an honest state. If the flags drive a batch record, the record should be written before they are cleared. The OTU page animates this batch-start pattern.

Problem 5: two latches, one bit, and an OTE

A colleague added an HMI indication to an existing program. The existing logic is XIC(Seal_Fail_Sensor) OTL(Seal_Fail) and XIC(Seal_Fail_Reset) OTU(Seal_Fail). The new rung, near the end of the routine, is XIC(Seal_Fail) XIO(Lamp_Test) OTE(Seal_Fail), meant to “show the fault unless lamp test is on”. Now the fault clears itself whenever the lamp test is pressed. Explain and fix.

Show the solution

The new rung writes Seal_Fail with an OTE. While lamp test is pressed, its rung is false, so the OTE writes 0 to the latched bit: lamp test clears the fault. When lamp test is released, the OTE writes the bit’s own current value back, which is now 0. The latch is lost.

Never put an OTE on a latched bit. Drive the indication from a separate bit:

[XIC(Seal_Fail) ,XIC(Lamp_Test) ] OTE(Seal_Fail_Lamp);

The latch keeps its two writers, OTL and OTU, and the lamp gets its own owner. A cross-reference check on every latched bit for OTE or MOV writers is worth adding to code review.

Where OTL fits in this guide

OTL is the fourth instruction in Joltek’s PLC Programming guide, after XIC, XIO and OTE. Its partner, OTU, covers the other half of every latch: what clears it, when, and which side wins. After that come the one-shot, timers and counters. The instruction glossary lists them all.

If your team needs this kind of grounding on its own equipment and programs, that is what our hands-on PLC and SCADA training for plant teams is for.

References and further reading

  1. Logix 5000 Controllers General Instructions Reference Manual (1756-RM003) · Rockwell AutomationOutput Latch (OTL) and Output Unlatch (OTU): execution tables, prescan and postscan leave the bit unchanged. Read in revision P (December 2014).
  2. SLC 500 Instruction Set Reference Manual (1747-RM001) · Rockwell AutomationOTL and OTU as retentive output instructions; state kept through a power cycle; first pass bit S:1/15; unexpected start-up warning.
  3. STL for S7-1500: S, Set; R, Reset · Siemens, TIA Portal V20 online help
  4. CODESYS LD/FBD: Coil (set and reset coils) · CODESYS Group, online help
  5. Coils (LD) · Phoenix Contact, PLCnext Engineer help
  6. FAQ 22456: duplicated coil check with SET and RST on one device · Mitsubishi Electric
  7. ISO 14118:2017, Safety of machinery: Prevention of unexpected start-up · International Organization for Standardization

← PLC Programming guide and instruction glossary

Have a project that needs technical ownership?

Send us the situation. If it is not something we should take on, we will say so.

The Plant-Side Brief

The weekly brief for the people who own a plant’s control systems.

One email every Wednesday for engineering and operations leaders responsible for controls, SCADA, MES and OT networks. Skim the top in two minutes; read the Deep Dive when you have fifteen.

  • One modernization problem, worked through to cost, risk and a schedule you can defend. The Deep Dive.
  • End-of-support dates before they reach your plant Windows, servers, controllers and HMI software. Lifecycle Watch.
  • A checklist your engineers can run that week not a framework to admire. Field Kit.
  • Every number sourced, no vendor agenda we are paid by plants, never by vendors.