Walkthrough: Problem 1: Button & Lamp ①

Difficulty

Target behavior

Light the lamp only while the button is pressed

What you will learn

  • N.O. contacts (LD) and coils (OUT)
  • A PLC executes the circuit from top to bottom, over and over (scan)

Problem

The first model is a simple one with just a button and a lamp.

Let's reproduce in ladder logic a behavior where the lamp lights only while the button is pressed.


What you need for this ladder are the most basic elements: an N.O. contact and a coil.

Assign the button to the N.O. contact and the lamp to the coil.


This problem is meant to get you used to operating the ladder and wiring screens, so feel free to check the answer first via the GitHub link below!

Target behavior (video)

Approach

A ladder diagram shows whether power flows from the left bus bar to the right bus bar. If all the contacts along the way are closed, the coil at the right end turns ON. This problem is the most basic circuit: one contact and one coil.

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.

1Turn on the lamp with the buttonRows 001–001

The N.O. contact of X0 (button) is connected to the coil of Y0 (lamp) with a horizontal line.

  • Press the button → X0 turns ON → the N.O. contact closes → the Y0 coil turns ON → the lamp lights
  • Release the button → X0 turns OFF → the N.O. contact opens → the Y0 coil turns OFF → the lamp goes out

An N.O. (normally open) contact closes (lets power through) when its device is ON. The PLC recalculates this circuit every few to several tens of milliseconds (a scan), so the button state is reflected on the lamp immediately.

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

Key points

  • X is an input (buttons, sensors) and Y is an output (lamps, solenoid valves). The numbers you wire on the Wiring tab must match the numbers in the ladder.
  • Fill the empty cells between a contact and a coil with horizontal lines (LINE) to connect them.