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
MOD
MOD parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
When set to true, the instruction is enabled.
  • TRUE: Execute the current computation.
  • FALSE: There is no computation.
Applies to ladder diagram programs.
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 function block diagram example
MOD ladder diagram example
MOD ladder diagram example
MOD structured text example
MOD structured text example
(* ST Equivalence: *) division_result := (value / divider); (* integer division *) rest_of_division := MOD (value, divider); (* rest of the division *)
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal