MODTURNS

MODTURNS 1:

The MODTURNS function carries out a modulo division and determines the signed integral component (modulo periods, modulo rotations).

Examples

MODTURNS ( 800.56, 360) = 2
MODTURNS ( -400.56, 360) = -2

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

ModuloSetTurns := MODTURNS ( NcToPlc.fPosSoll, 360 );

FUNCTION MODTURNS : 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)

MODTURNS 2: