01Level 1
Turn on a lamp with a switch
The simplest program: one input and one output. Perfect for seeing power flow and the scan cycle for the first time.
Open in the simulator
The simulator is designed for computers (screens 1024 px or wider).
Virtual plant
Lamp off
Shown at rest. In the simulator the plant moves according to your program's outputs.
Inputs and outputs
| Address | Name | Description |
|---|---|---|
| I0.0 | SWITCH | Wall switch (maintained) |
| Q0.0 | LAMP | Ceiling lamp |
Program
Ladder diagram (LD)
Rung 1 — The lamp follows the switch.
Function block diagram (FBD)
Network 1 — The lamp follows the switch.
Structured text (ST)
(* Turn on a lamp with a switch — converted from Ladder *)
(* Rung 1: The lamp follows the switch. *)
LAMP := SWITCH;Instruction list (IL)
(* Turn on a lamp with a switch — converted from Ladder *) (* Rung 1: The lamp follows the switch. *) LD SWITCH ST LAMP
Step by step
- 1Press ▶ Run (F5) to put the PLC in RUN.
- 2Flip switch I0.0 on the panel: the plant's lamp turns on and the rung turns green.
- 3Change the contact to a normally closed (NC) one in the properties panel: now the lamp is on while the switch is off.
- 4Open the “Scan cycle” tab and step through it to see when the output actually changes.