LMOD

LMOD 1:

The LMOD function carries out a modulo division and returns the signed residual.

Examples

LMOD( 400.56, 360) = 40.56
LMOD( -400.56, 360) = -40.56

Similar functions: MOD, MODABS

Notes: Unlike MOD, the LMOD function operates with floating point variables and determines non-integer residuals.

In the context of NC axes, modulo values are usually used unsigned. These can be calculated with the MODABS function.

FUNCTION LMOD : LREAL

VAR_INPUT
    lr_Value  : LREAL;
    lr_Arg    : LREAL;
END_VAR

lr_Value : Input value

lr_Arg : Modulo range

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.9.0 build 1000 onwards

PC or CX (x86)

TcMath.Lib

TwinCAT v2.10.0 Build >= 1301

CX (ARM)

LMOD 2: