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.
Table of contents
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.

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 executes | What happens to the bit | Rung condition out |
|---|---|---|
| Prescan (when the controller enters Run mode) | Not modified | False |
| Rung condition coming in is false | Not modified | False |
| Rung condition coming in is true | Set to 1 | True |
| Postscan | Not modified | False |
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.
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.

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.

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.

| OTE with a seal-in | OTL with an OTU | |
|---|---|---|
| Keeps the bit on after Start is released | Yes, through its own branch | Yes, because OTL does nothing on a false rung |
| Drops out when a permissive is lost | Yes, by itself | Only if an OTU or another writer clears it |
| After prescan (entering Run) | Cleared: waits for Start | Unchanged: carries on |
| After a power cycle | Cleared when the program restarts | Kept, if the controller retains memory (SLC 500: yes) |
| Where the logic lives | One rung | At least two rungs, often far apart |
| Best for | Equipment that moves: motors, valves, heaters | Memory: 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.

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.

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.

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.
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.
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.

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.
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.
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.
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.
| Vendor | Software | Name of the instruction | Example operand | Text form |
|---|---|---|---|---|
| Rockwell Automation | Studio 5000 Logix Designer | OTL, Output Latch | Jam_Latched | Rung text OTL(Jam_Latched); ST IF c THEN Jam_Latched := 1; END_IF; |
| Rockwell Automation | RSLogix 500 (SLC 500, MicroLogix) | OTL, Output Latch | B3:0/4, O:2/0 | OTL B3:0/4 |
| Siemens | TIA Portal (S7-1500) | Set output | "Jam_Latched", %M10.0 | STL S "Jam_Latched" |
| Mitsubishi Electric | GX Works3 (MELSEC iQ-R) | SET instruction | M10, Y20 | SET M10 |
| IEC 61131-3 / CODESYS, Beckhoff | CODESYS, TwinCAT 3 | Set coil | A named BOOL variable | ST IF c THEN bJam := TRUE; END_IF; |
| Phoenix Contact | PLCnext Engineer | Set coil | A named BOOL variable | ST conditional assignment |
| AutomationDirect | CLICK Programming Software | Set coil | C10, Y001 | None; 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.
DO_Run_MTR, set by an XIC on DI_Start_BTN. The bit stays on after the start button is released until the OTU on rung 1 clears it. Screenshot: RealPars, PLC Latching vs Sealing Explained Simply.
O:0/0 (MOTOR STARTER), set by an XIC on I:0/0 (START BUTTON). The coil is drawn with an L and the OTU on rung 0001 is its pair. Screenshot: SolisPLC, PLC Programming Fundamentals: OTL Output Latch Instruction.
EW_RED_LIGHTS in a bank of parallel coils after timer TON_2. The set coil latches the variable on until a reset coil clears it. Screenshot: Rockwell Automation, Micro800 and Connected Components Workbench Getting Started Guide.
"Auto_mode" (%M0.0), driven by a normally open contact on "Start" (%I0.0). Siemens draws the latching coil as S and the reset as R. Screenshot: SolisPLC, An Introduction to Basic Ladder Logic Instructions in Siemens TIA Portal.
-(s)- on #Error, set when the T6 on-delay timer output goes true. The coil keeps #Error on until a reset coil clears it. Screenshot: Siemens AG, Programming with STEP 7.
SET W0.00 instruction, which turns W0.00 on and keeps it on until an RSET W0.00 runs. Omron SET and RSET are boxed instructions rather than coil symbols. Screenshot: Omron, CP1E CPU Unit Software User's Manual (W480).
Y001, which stays on after the contact on X001 goes false. Screenshot: AutomationDirect, CLICK help, Set Coil.
SET) on the "RS485 Change Settings" output at the end of rung 2. Screenshot: AutomationDirect, Productivity Suite help, Building a Ladder Logic Program.
S) on memory bit %M1 (TIMERTRIGGER) in rung 0, driven by a rising-edge button contact. Screenshot: Schneider Electric, FAQ FA383792 (Machine Expert - Basic project).
S) on variable bvar2, shown beside its reset counterpart. Screenshot: Schneider Electric, Machine Expert help, Set/Reset Coil.
b1, fed from a function block output. Screenshot: CODESYS Group, CODESYS Ladder, Programming in the LD editor.
b1, driven by the ENO output of a function block. Screenshot: Beckhoff Automation, Programming in the Ladder editor.
xRunning, energised by the xStart contact. Screenshot: ABB, AC500 V3 PLC - Bistable, Counter, Timer & Trigger (Technical Note 12).
Tank3_Valve_M3, with a negated contact Tank3_Min_S8 in the rung. Screenshot: Bosch Rexroth community, How to run a ladder diagram simulation using ctrlX PLC 1.20.7 (forum post).
M0, triggered by a rising-edge contact on X0.0. Screenshot: Delta Electronics, ISPSoft User Manual.
Y0, triggered by a rising-edge contact on X0. Screenshot: Panasonic Industry, Control FPWIN Pro7 help: SET / RST.| Vendor | Software | Why it is not shown yet |
|---|---|---|
| Siemens | LOGO!Soft Comfort | We found no set coil in LOGO! ladder in the V8.4 help; latching is done with the RS latching relay block. |
| Omron | Sysmac Studio | No public screenshot of a SET coil in the editor; the manual shows drawn symbols only. |
| AutomationDirect | Do-more Designer | No public screenshot of a SET instruction in the editor. |
| Mitsubishi Electric | GX Works3, GX Works2 | The training manuals show SET as a drawn figure, not an editor window. |
| Schneider Electric | EcoStruxure Control Expert | The manual’s LD chapter shows only drawn symbols. Machine Expert and Machine Expert - Basic are shown above. |
| Emerson | PAC Machine Edition | The only set coil figure found is too small to frame legibly. |
| Phoenix Contact | PLCnext Engineer | No public screenshot of a set coil in the editor. |
| KEYENCE, B&R, Inovance | KV STUDIO, Automation Studio, InoProShop | No 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.
- 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.
- 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.
- 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?
- 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.
- 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:FSin Logix,S:1/15on an SLC 500). - 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.
- 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
| Mistake | What happens | Fix |
|---|---|---|
| Latching a run command for equipment | The equipment restarts after a mode change or power cycle | Use a seal-in, or clear the latch on the first scan |
| No reset path | The latch can only be cleared by going online | Write the OTU rung at the same time as the OTL |
| Expecting the OTU to win while the cause is present | The bit flickers or never clears | Decide which side dominates; reset only when the cause is gone |
| OTL and OTE on the same bit | The OTE writes 0 whenever its rung is false and erases the latch | One approach per bit |
| One latch bit shared by several parts or batches | The next part or batch inherits the last one’s state | Store state per part or per batch, and clear it as data moves |
| Driving a counter, log or move from the OTL rung | It runs on every scan the rung is true | One-shot for the event, latch for the state |
| Treating a latched trip as the protection layer | Protection depends on standard logic | Independent 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
What does an OTL do when its rung is false?
Rockwell's execution table says the bit is not modified when the rung condition is false. That is what makes a latch a latch.
What happens to a latched bit during prescan, when the controller enters Run?
OTL does not modify its bit in prescan or postscan. A latched bit comes through a mode change with whatever value it had, unlike an OTE bit, which prescan clears.
Is OTL edge-triggered?
OTL is level-sensitive. It looks edge-triggered because writing 1 to a bit that is already 1 changes nothing, but it will set the bit again on the next scan if something clears it while the rung is true.
On an SLC 500, a latched output was on when power failed. What happens when power returns?
Rockwell's SLC 500 manual says OTL and OTU retain their state through a power cycle, so the output can come back on with nobody pressing Start. Clear such bits on the first pass, using S:1/15, or use a seal-in instead.
What is the Logix first-scan bit you would use to clear latches at start-up?
S:FS is the Logix first-scan bit. S:1/15 is the SLC 500 first pass bit.
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?
Prescan clears the seal-in's OTE but leaves the OTL alone. That difference is why most programmers seal in equipment and keep latches for memory.
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?
Both write the same bit when they execute. The later one in scan order sets the final value; the earlier one's value is seen by the rungs in between.
What is the structured text equivalent of OTL(Fault_Mem) on a rung with condition c?
OTL exists in relay ladder only. The structured text equivalent writes 1 only when the condition is true and does nothing otherwise.
Which of these is the best use of OTL?
Latches are for memory that must outlast its cause. The others should follow their conditions, which is OTE's job.
What does Siemens TIA Portal call the OTL equivalent in LAD?
Siemens calls it a set output, written S in STL. Its partner is the reset output, R.
That's the basics covered. If you'd like the next instruction in this guide in your inbox, the sign-up is below. It's never needed to see an answer.
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.
Keep learning between pages
Sign up for The Plant-Side Brief, Joltek's free weekly email for controls engineers and technicians. Every answer on this page stays open whether you sign up or not.
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
- 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).
- 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.
- STL for S7-1500: S, Set; R, Reset · Siemens, TIA Portal V20 online help
- CODESYS LD/FBD: Coil (set and reset coils) · CODESYS Group, online help
- Coils (LD) · Phoenix Contact, PLCnext Engineer help
- FAQ 22456: duplicated coil check with SET and RST on one device · Mitsubishi Electric
- ISO 14118:2017, Safety of machinery: Prevention of unexpected start-up · International Organization for Standardization