Learning library

Ladder logic programming

Learn a repeatable method for turning a control requirement into inputs, Boolean conditions, state, a ladder program and acceptance cases.

Write the rule before the rung

Begin with a sentence that names the output and its conditions. “The lamp follows Switch” is a combinational rule. “The motor stays on after Start until Stop is pressed” requires memory. These are different requirements, even if both start by turning on a device. Decide what must happen on release as well as on press.

List the inputs, outputs and initial values. Give input bits meanings you can state as true or false. For example, StopOK means permission to run, while LevelHigh means the upper limit has been reached. Clear bit meanings prevent a physical NC switch from being confused with an NC instruction.

Translate conditions into paths

Use series contacts for conditions that must all hold. Use parallel branches for alternative reasons to energize one output. Use a NC instruction when the rule requires a named bit to be false. Keep the conditions that override everything, such as a stop permissive, on every path that can energize the output.

For a holding circuit, write the expression first: MotorRun = StopOK AND (Start OR MotorRun). The feedback term preserves the previous running state. For a tank, Pump = NOT LevelHigh AND (LevelLow OR Pump) gives high-level stop priority while preserving state between thresholds.

Add time or events deliberately

Use TON when a condition must stay true for a preset delay. Its elapsed time resets when the input becomes false in this simulator. Use CTU when separate rising edges must be counted. Holding an input true advances a running timer, but it does not repeatedly increment an up counter.

For a multi-step sequence, give each phase an internal bit and define how it starts, holds and ends. Then connect outputs to the active state. Read the final program in scan order: later rungs see earlier writes, so individually plausible rungs can behave differently if moved.

Check transitions, not just snapshots

For two Boolean inputs, check all four combinations. For memory, check the same inputs after different histories. For time, check before and at the preset. For a counter, check a held input, distinct pulses and reset. These observations tell you whether the program matches the rule rather than merely producing one convincing screen.

Work through AND and OR first, then the motor latch and tank hysteresis. Each exercise includes a reference diagram and named acceptance cases. Explain the result in words before moving on to a larger program.

Practice this lesson

Each walkthrough includes a reference diagram and a link to its editable simulator. Review the simulation limitations when comparing results with another environment.

Continue learning