How to Use Latch and Unlatch in Ladder Logic for PLCs
In ladder logic, use the
LATCH instruction to turn on an output and keep it on even if the input turns off. Use the UNLATCH instruction to turn off that output when needed. This lets you control devices that stay on until explicitly turned off.Syntax
The LATCH and UNLATCH instructions control outputs that maintain their state independently of the input signal after activation.
- LATCH (Set): Turns on the output and keeps it on until an
UNLATCHcommand is given. - UNLATCH (Reset): Turns off the output latched previously.
Typical syntax in ladder logic:
ladder_logic
----[Input Condition]----(LATCH)----(Output Coil) ----[Input Condition]----(UNLATCH)----(Output Coil)
Example
This example shows a start button that latches a motor output on, and a stop button that unlatches it off.
ladder_logic
----[Start Button]----(LATCH)----(Motor Output) ----[Stop Button]----(UNLATCH)----(Motor Output)
Output
When the Start Button is pressed, Motor Output turns ON and stays ON even if Start Button is released.
When the Stop Button is pressed, Motor Output turns OFF.
Common Pitfalls
Common mistakes include:
- Using
LATCHwithout a matchingUNLATCH, causing outputs to stay on forever. - Confusing
LATCHwith a normal coil that only stays on while input is true. - Not ensuring
UNLATCHconditions are reachable, so the output never turns off.
Always pair LATCH and UNLATCH properly to avoid stuck outputs.
ladder_logic
Wrong: ----[Start Button]----(LATCH)----(Motor Output) (no UNLATCH instruction) Right: ----[Start Button]----(LATCH)----(Motor Output) ----[Stop Button]----(UNLATCH)----(Motor Output)
Quick Reference
| Instruction | Function | Effect |
|---|---|---|
| LATCH | Set output | Turns output ON and keeps it ON until UNLATCHed |
| UNLATCH | Reset output | Turns output OFF that was previously latched |
| Normal Coil | Momentary output | Output ON only while input condition is true |
Key Takeaways
Use LATCH to turn on an output that stays on after input turns off.
Use UNLATCH to turn off a latched output when needed.
Always pair LATCH and UNLATCH to avoid outputs stuck ON.
LATCH differs from normal coils which only stay ON while input is true.
Check that UNLATCH conditions are reachable to reset outputs properly.