MOD (modulo)
The MOD instruction divides the IN input by the Base input and place the remainder in the MOD output.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
MOD

Parameter | Parameter Type | Data Type | Description |
---|---|---|---|
EN | Input | BOOL | When set to true, the instruction is enabled.
|
IN | Input | DINT | Any signed integer value. |
Base | Input | DINT | Must be greater than zero. |
MOD | Output | DINT | Modulo calculation (input MOD base)/returns -1 if Base <= 0. |
ENO | Output | BOOL | Enables output. Applies to ladder diagram programs. |
MOD examples
MOD function block diagram example

MOD ladder diagram example

MOD structured text example

(* ST Equivalence: *) division_result := (value / divider); (* integer division *) rest_of_division := MOD (value, divider); (* rest of the division *)
Results

Provide Feedback