Skip to content

MUL — Multiply

Category
Compute
Type
Output
Availability
All platforms

MUL instruction block: Source A Boxes, Source B Per_Box, Dest Pieces


MUL (Multiply) writes the product of Source A and Source B to Dest every scan its rung is true. It is an output instruction with no state and no status bits. Use MUL to scale a reading by a gain, convert units, or turn a count of containers into a count of pieces. Do not use MUL for a scale that also needs an offset; SCP does the whole linear conversion in one instruction, and CPT handles anything longer.


Operand Type Format Valid Range Required Description
Source A Any numeric tag, member, element or bit, or a literal Tag, Tag.Member, Tag[n], Tag.bit, or a literal Any resolvable numeric reference Yes The first factor.
Source B Same as Source A Same Any resolvable numeric reference Yes The second factor.
Dest A writable numeric tag, member or element Tag, Tag.Member, Tag[n] SINT, INT, DINT or REAL; not a literal, not an input pin Yes Where the product is written.

Literals may be whole numbers (25, -3, 0x1F) or decimals (0.0625). A BOOL source reads as 0 or 1.

Dest type. Products outgrow an INT quickly: 200 × 200 is already past 32767, and the result wraps silently with no flag and no fault. Use a DINT Dest for anything but small factors, and a REAL Dest when a factor has a fraction.


Nothing. Dest keeps its power-up value.

The instruction does nothing. Dest holds its last value.

Both sources are read, multiplied, and the product is written to Dest every scan the rung is true.

Nothing.


Scenario: A palletiser counts boxes. Each box holds a fixed number of pieces, and the order system wants pieces.

Tags:

  • Calc — Compute pieces, BOOL
  • Boxes — Boxes counted, INT
  • Per_Box — Pieces per box, INT
  • Pieces — Total pieces, INT

Rung 1:

—] [Calc———[MUL Boxes Per_Box Pieces]———

Scan 1 — Calc = 0. Boxes reads 12 and Per_Box reads 24. The rung is false: Pieces holds 0.

Figure 1 — MUL rung false: Boxes 12, Per_Box 24, Pieces 0, rung dark

Scan 2 — Calc = 1. 12 × 24 is written: Pieces reads 288.

Figure 2 — MUL rung true: Pieces reads 288, rung lit

An INT Dest is fine here because the largest order is a few thousand pieces. A line that counts to a hundred thousand needs Pieces declared as a DINT.


  • DIV — Divide
  • SCP — Scale with Parameters (gain and offset in one instruction)
  • XPY — X to the Power of Y
  • CPT — Compute
  • Compute Instructions — Category index

Percent scaling. MUL Raw 0.1 Value into a REAL keeps the tenths. The same instruction into an INT Dest truncates them away.

Sign. A negative factor gives a negative product; nothing is clamped.

The block never colours. Watch the rung wire and the Dest value line.

Applies to LadderIDE >=1.2.2 · Last reviewed 2026-09-11 · Screenshots verified 2026-09-11