The Modulo instruction is a ladder logic rung output instruction that divides two values and retains the remainder. The instruction is enabled when the preceding logic is true and disabled otherwise. Source A is divided by Source B and the remainder is placed in the Destination tag. The values can be constants, tags or any combination.
A minor fault occurs if the divisor is 0. To monitor a divide by zero look at the minor fault bit S:MINOR.
List of possible arguments
SOURCE A and SOURCE B can be any combination of the following data types.
- CONSTANT Can’t be the DESTINATION obviously
- SINT
- INT
- DINT
- REAL
Note: Negative numbers are valid. Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry.