Walkthrough: Problem 2: Button & Lamp ②

Difficulty

Target behavior

Press the button once and the lamp stays lit

What you will learn

  • Self-holding circuit
  • How to write a parallel (OR) circuit

Problem

This is the same model as Problem 1, with just a button and a lamp.

This time, reproduce a behavior where pressing the button once keeps the lamp lit.


You still only need N.O. contacts and coils, but it takes a little trick.

The ladder you write here is called a self-holding circuit, the most famous circuit in PLC programming. Make sure you learn it!


The wiring is the same as Problem 1, so feel free to reuse it!

Target behavior (video)

Approach

To keep the lamp lit after the button is released, add "the lamp is ON" itself to the condition for turning it on. Because the output keeps itself ON, this is called a self-holding circuit. It is the most commonly used circuit in PLCs.

Based on this approach, try writing the ladder yourself first.
In the simulator, you can create the wiring and ladder and actually run the 3D equipment model.

Try it in the simulator
Show the sample ladder and explanation(click to open)

Devices used

DeviceComment
Inputs
X0Button
Outputs
Y0Lamp

Ladder explanation

The row numbers in the figures match the row numbers in the simulator's ladder window.

1Self-holding circuitRows 001–002

Below X0 (button), an N.O. contact of Y0 (lamp) itself is placed in parallel. Parallel means "power flows if either one is closed" = OR.

  1. Pressing the button turns Y0 ON through X0
  2. From the next scan, the Y0 N.O. contact on row 002 also closes
  3. Even after the button is released and X0 turns OFF, power keeps flowing through the Y0 contact, so the lamp stays lit

The sample wiring and ladder data can be downloaded fromGitHuband loaded with "Load wiring" and "Load ladder" in the simulator.

Key points

  • This circuit has no way to turn the lamp off. In real equipment, the standard approach is to put an N.C. contact (LDB) of a stop button in series, so that pressing the stop button breaks the hold.
  • Vertical lines are used to merge the outputs of two rows (OR).