Instructions

Reference pages for every Ladder Logic instruction available in rungs.dev.

Every instruction below is documented with its operands, behaviour across scans, and worked examples. Use the sidebar to jump to one, or start with the basics.

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.

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.

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 or COUNTER tag back to zero — typically paired with RTO, CTU, or CTD on the same tag.

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.

NOP / AFI — No Operation and Always False

NOP and AFI in rungs.dev — NOP is a placeholder that does nothing, AFI forces the rest of its rung false. Both are used while building and debugging programs, not in finished logic.

Compare — EQ / NE / GT / GE / LT / LE

Reference for Ladder Logic compare instructions in rungs.dev — EQ, NE, GT, GE, LT, LE — that pass power along a rung when the numeric relationship holds.

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.

Math — ADD / SUB / MUL / DIV / MOD

Reference for Ladder Logic math instructions in rungs.dev — ADD, SUB, MUL, DIV, MOD — performing arithmetic on two sources and writing the result to a destination tag.

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.

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.