MODABS

MODABS 1:

The MODABS function carries out a modulo division and determines the unsigned modulo value within the modulo range.

Examples

MODABS( 400.56, 360) = 40.56
MODABS( -400.56, 360) = 319,44

Similar functions: MOD, LMOD

Note: The MODABS function can be used to calculate the modulo set position of an NC axis from its absolute set position.

ModuloSetPosition := MODABS( NcToPlc.fPosSoll, 360 );

FUNCTION MODABS : LREAL

VAR_INPUT
    lr_val  : LREAL;
    lr_mod  : LREAL;
END_VAR

lr_val : Input value

lr_mod : 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)

MODABS 2: