Ladder logic (LAD) on the S7-200
Contacts, coils, series and parallel, the self-holding circuit, set and reset, interlocks, and the normally closed input trap. Build every rung yourself and run it on a virtual PLC-200.
40 min
On this page
Ladder diagram (LAD, IEC 61131-3) draws a program the way an electrician draws a control circuit: a power rail on the left, rungs (networks) running to the right, contacts that let "power flow" through, and coils or boxes at the right end. In STEP 7-Micro/WIN each rung lives in its own network, numbered from 1.
The picture is borrowed from relays, but nothing flows: the CPU reads bits, evaluates each network from left to right and top to bottom, and writes bits. Keep both views in mind. The relay view helps you read a rung; the bit view tells you what the CPU really does.
Contacts and coils
| Element | Symbol | Passes power when… | STL |
|---|---|---|---|
| Normally open contact | –| |– | the bit is 1 | LD / A / O |
| Normally closed contact | –|/|– | the bit is 0 | LDN / AN / ON |
| Coil (output) | –( ) | writes the power flow into the bit | = |
| Set / Reset coil | –(S) –(R) | writes 1 / 0 only when powered, then leaves the bit alone | S / R |
| Positive / negative transition | –|P|– –|N|– | for one scan when the power flow goes 0→1 / 1→0 | EU / ED |
Series contacts are an AND, parallel contacts an OR. Try it: the editor below runs on a simulated CPU 224. Flip the input switches on the PLC-200 panel (the lever latches; the small "(ON)" button is the momentary position) and watch power flow turn the wires green.
Drag an instruction onto the rung (or click it, then click a place). Drop below a contact to put it in parallel. Click an element to edit its address; Delete removes it.
No errors: the program compiles.
FoundationStart here if this is new to you
Think of a rung as a garden hose with taps. Taps in a row (series) must all be open for water to reach the end. Taps side by side (parallel) give the water a second way round: any open one will do. The coil is the sprinkler at the end.
A contact reads a bit, not a button
This is the most important sentence of the lesson. A normally closed contact in the program does not mean a normally closed button in the field. It means "pass power when this bit is 0".
On the PLC-200, and in every TP of the booklet, STOP buttons, emergency stops, overload contacts and pull cords are normally closed devices: the input is ON (1) when healthy and goes OFF when the device is pressed, or when its wire breaks. To make a machine stop when the input goes OFF, you use a normally open contact on that input:
Predict first
STOP_NC (I0.1) is wired to a normally closed stop button, so I0.1 = 1 while nobody presses it. Which contact do you put in series with the motor rung?
The self-holding circuit
A motor started by a momentary START button must keep running when the button is released. The rung "remembers" by feeding the coil's own bit back in parallel with START; STOP_NC and the overload F2_NC are in series so either of them breaks the rung.
Your turn: the program below only follows START. Drag a normally open contact below START to put it in parallel, set its address to RUN; then add STOP_NC and F2_NC in series. Press Check my program to run an automatic test on your rung.
Drag an instruction onto the rung (or click it, then click a place). Drop below a contact to put it in parallel. Click an element to edit its address; Delete removes it.
No errors: the program compiles.
Open the STL view tab: the parallel group becomes LD START / O RUN, the series contacts A STOP_NC / A F2_NC, the coil = RUN. The column on the left is the value on top of the logic stack after each instruction, live, exactly like Micro/WIN's program status.
ExplorerGo deeper: derivations and open questions
Why doesn't the motor restart after STOP is released? Because the seal-in contact reads RUN, which is already 0. The rung needs a new START. This is the "no unexpected restart" rule of IEC 60204-1 (§7.5): after a stop or a power return, a machine must not start by itself.
Set and reset
S RUN, 1 writes 1 into RUN when its rung has power and does nothing otherwise; R RUN, 1 writes 0. The bit keeps its value between the two. Because the CPU executes networks in order, the last write in the scan wins: put the reset network after the set network and STOP has priority, which is what you want for a stop.
Drag an instruction onto the rung (or click it, then click a place). Drop below a contact to put it in parallel. Click an element to edit its address; Delete removes it.
No errors: the program compiles.
Interlocks
Two contactors that must never close together (forward/reverse, star/delta) each get a normally closed contact of the other in their rung. In industry the interlock also exists as a hard-wired auxiliary contact, because the program cannot see a welded contactor.
Drag an instruction onto the rung (or click it, then click a place). Drop below a contact to put it in parallel. Click an element to edit its address; Delete removes it.
No errors: the program compiles.
Rules Micro/WIN enforces
- A coil cannot be connected straight to the left rail; use
SM0.0(Always_On) as the contact. Boxes (MOV, timers) can. - Contacts go left, coils and boxes go right; nothing after a coil in the same branch.
- One network = one rung (with branches); an unconnected element makes the network uncompilable.
- Inputs
Iare read-only in the program; write onlyQ,M,V,S.
Download .awl gives you the program in Micro/WIN's export format. In STEP 7-Micro/WIN, use File → Import to bring it into a project, then enter the symbol table (Download symbol table) before compiling.