PlantFlow 3DSimulatorGuidesDownloadAboutContactEnglishالعربيةاردو

PlantFlow 3D › Guides › PLC ladder logic basics

PLC ladder logic basics

Contacts, coils, latches, timers and counters explained with a real pump control program, and how a PLC scan works.

How a PLC scan works

A PLC repeats the same cycle many times a second: it reads all inputs into memory, solves the program rung by rung from top to bottom, then writes the results to the outputs. Because outputs are written at the end, the order of rungs matters when one rung uses a result from another.

Contacts and coils

A normally-open contact (XIC, drawn ] [) passes "power" when its bit is 1. A normally-closed contact (XIO, ]/[) passes power when its bit is 0. Contacts in series make an AND; parallel branches make an OR. The output coil (OTE) at the end of the rung sets its bit to the result of the rung on every scan.

Note that the PLC contact type has nothing to do with the field wiring: an emergency stop is wired normally-closed so that a broken wire stops the machine, and the program then checks that its input is ON (XIC) to allow running.

Latches, timers and counters

A latch (OTL) sets a bit and keeps it set until an unlatch (OTU) clears it. The pump example latches a "demand" bit when the level falls below the start set-point and unlatches it at the stop set-point, which creates hysteresis.

An on-delay timer (TON) starts timing when its rung becomes true and sets its done bit after the preset time. The example uses one to supervise the pump: if the run command is on but no running feedback arrives within 3 s, the pump is declared failed. A counter (CTU) counts rising edges, such as pump starts.

Good habits

Comment every rung, use meaningful tag names, keep safety functions (emergency stop, overfill) in hard-wired circuits as well as in the program, and test each rung by forcing its inputs in simulation before commissioning.

Try it yourself

Open PLC & Process → Ladder program. Watch the power flow in each rung while the tank fills and empties, and edit a rung to see the effect immediately.

Open the PlantFlow 3D simulator →

Safety: this guide explains principles for learning. Real installations must follow the applicable codes, the equipment manufacturer's instructions and the approval of a competent, qualified person. Isolate, lock off and prove dead before touching any circuit.

Related guides