Overview Modulo

This block calculates the remainder of a division. The value at input WT is divided by the divisor and the remainder of this division is put out. The divisor is taken from input DV or – as long as this input is not assigned – from the parameter Divisor. If the divisor is 0, the output Remainder is set to 0 and the error output to 1. Typical applications are splitting seconds into minutes and seconds, limiting an angle to 0 to 359 degrees or stepping through several outputs in turn.


Inputs

WT Value Value whose remainder is calculated (dividend).
DV Divisor Divisor. If the input is not assigned, the parameter Divisor applies. “Generate variables” deliberately does not create an address for this input so that the fixed value stays effective.



Outputs

RE Remainder Remainder of the division.
FE Error Becomes 1 if the divisor is 0. In this case the output Remainder is set to 0.



Parameters

Divisor Fixed value used as long as input DV is not assigned.
Sign
  • Sign as input value: the remainder gets the sign of the input value (-7 mod 3 = -1).
  • Result always positive: the remainder is always put out as a positive value (-7 mod 3 = 2). Useful for angles, for example.

See also: Division (1xE), Formula

See also common parameters of all function blocks.