Instructions
Reference pages for every Ladder Logic instruction available in rungs.dev.
Each page gives the instruction's operands, what it does across scans, and a worked example.
Bit
XIC — Examine If Closed
XIC (Examine If Closed) passes power along a ladder rung when the referenced bit is 1 — a normally-open contact in the rungs.dev ladder simulator.
XIO — Examine If Open
XIO (Examine If Open) in rungs.dev passes power along the rung when the referenced bit is 0 — a normally-closed contact.
OTE — Output Energize
OTE in rungs.dev is the standard output coil — sets a BOOL bit to 1 while the rung is true and back to 0 when the rung goes false. The default ladder output.
OTL / OTU — Latch and Unlatch
OTL latches a bit to 1 and holds it on after the rung goes false. Pair it with OTU to unlatch the bit back to 0 in the rungs.dev ladder simulator.
ONS — One Shot
ONS in rungs.dev makes a ladder rung true for exactly one scan on each rising edge of its input. Requires a dedicated storage BOOL per ONS instance.
OSR / OSF — One Shot Rising and Falling
OSR sets an output bit for one scan when its rung turns on; OSF sets it for one scan when the rung turns off. Both use a dedicated storage BOOL in the rungs.dev ladder simulator.
Timer/Counter
Timers Overview
Reference for Ladder Logic timer instructions in rungs.dev — TON, TOF, RTO, and RES — and the TIMER tag structure with preset, accumulator, and status bits.
TON — On-Delay Timer
TON in rungs.dev is the on-delay timer — starts timing when the rung goes true, sets the .DN bit when .ACC reaches .PRE, and resets when the rung goes false.
TOF — Off-Delay Timer
TOF in rungs.dev is the off-delay timer — starts timing when the rung goes false and holds the .DN bit at 1 for the preset duration after the rung drops.
RTO — Retentive Timer On
RTO in rungs.dev is the retentive on-delay timer — like TON, but the .ACC accumulator survives rung transitions and must be cleared explicitly with RES.
Counters Overview
Reference for Ladder Logic counter instructions in rungs.dev — CTU, CTD, and RES — and the COUNTER tag with preset, accumulator, and done/up/down status bits.
CTU — Count Up
CTU (Count Up) in rungs.dev increments .ACC by 1 on each rising edge of the rung. Sets .DN when .ACC reaches .PRE and keeps counting past the preset value.
CTD — Count Down
CTD (Count Down) in rungs.dev decrements .ACC by 1 on each rising edge of the rung. Typically paired with CTU on the same COUNTER tag for bidirectional counting.
RES — Reset
RES in rungs.dev clears the accumulator and status bits of a TIMER, COUNTER or CONTROL tag back to zero — typically paired with RTO, CTU, CTD, or an array instruction on the same tag.
Math
CPT — Compute
CPT (Compute) works out a whole expression in one box and stores the answer in a tag. Covers operator order, the REAL promotion rule, and why it is not a one-shot.
ABS / SQRT / NEG — One-Input Math
Reference for the one-input Ladder Logic math instructions in rungs.dev — ABS (absolute value), SQRT (square root), and NEG (negate). Each reads one Source and writes one Dest.
Move/Logical
MOVE / MVM — Copy a Value
MOVE copies a literal or tag into a destination tag every scan in rungs.dev, converting between DINT and REAL when the types differ. MVM is a masked move that copies only selected bits.
Logical & Bit Instructions
Reference for Ladder Logic bit instructions in rungs.dev — AND, OR, XOR, NOT, CLR, and BTD — combining, flipping, clearing, and relocating the individual bits of a DINT word.
Compare
CMP — Compare
CMP (Compare) works out an expression and uses the answer as the rung condition. Any value other than zero passes power. Covers AND versus &&, and why a bare bit needs XIC.
IsINF / IsNAN — Test for Infinity or Not a Number
IsINF and IsNAN test one REAL tag for infinity or for "not a number". Covers what produces each value, both Compare-tab boxes, and the same two tests written inside a CMP expression.
LIMIT — Range Check
LIMIT in rungs.dev passes power when a test value is inside [lowLimit, highLimit]; if lowLimit is greater than highLimit, the bounds reverse to outside-the-band.
Array
BSL and BSR — Bit Shift
BSL and BSR in rungs.dev move every bit of a DINT array one place along on each rising edge, feeding a new bit in at one end. Use them to track parts down a conveyor.
FFL and FFU — FIFO Queue
FFL and FFU in rungs.dev build a first-in first-out queue in an array — load a value at one end, take the oldest out at the other. Use them to track parts waiting their turn.
LFL and LFU — LIFO Stack
LFL and LFU in rungs.dev build a last-in first-out stack in an array — push a value on top, take the newest one back off. Use them for undo histories and nesting.
COP and CPS — Copy
COP and CPS in rungs.dev copy a run of elements from one array into another. Use them to snapshot a buffer, replicate a value, or move a batch of readings in one rung.
FLL — Fill
FLL in rungs.dev writes one value into every element of a run of an array. Use it to clear a buffer, preset a recipe, or zero a structure in one rung.
SIZE — Size In Elements
SIZE in rungs.dev counts the elements of an array and stores the count in a tag, so a rung never has to hardcode how long an array is.
AVE and STD — Average and Spread
AVE and STD in rungs.dev work out the average and the standard deviation of a run of array elements. Use them to smooth a noisy reading or to tell steady from unstable.
SRT — Sort
SRT in rungs.dev sorts a run of array elements into ascending order, in place. Use it to find a median, rank readings, or order a batch before working through it.
FAL and FSC — Loop Over an Array
FAL and FSC in rungs.dev run one expression once per array element. FAL stores each answer; FSC stops at the first element that passes. Use them to scale a batch or find a value.
Program
Expressions in Ladder
How to write an expression inside a ladder box with CPT and CMP — operator order, the REAL promotion rule, and the operators that do not behave the way maths does.
Bit Instructions Overview
Reference for Ladder Logic bit instructions in rungs.dev — XIC, XIO, OTE, OTL, OTU, and ONS — the contacts and coils that examine or control a single BOOL value.