Target behavior
Light the lamp only while the button is pressed
What you will learn
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!
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.
| Device | Comment |
|---|---|
| Inputs | |
X0 | Button |
| Outputs | |
Y0 | Lamp |
The row numbers in the figures match the row numbers in the simulator's ladder window.
The N.O. contact of X0 (button) is connected to the coil of Y0 (lamp) with a horizontal line.
X0 turns ON → the N.O. contact closes → the Y0 coil turns ON → the lamp lightsX0 turns OFF → the N.O. contact opens → the Y0 coil turns OFF → the lamp goes outAn 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.