MC_MoveModulo

MC_MoveModulo 1:

The function block MC_MoveModulo is used to execute a positioning operation, which refers to the modulo position of an axis. The basis for a modulo rotation is the adjustable parameter "Modulo Factor" of the AXIS_REF structure (Axis.Parameter.ModuloFactor, e.g. 360°). A distinction is made between three possible start types, depending on the "Direction" input.

Starting an axis from standstill

If an axis is started from standstill with MC_MoveModulo , it is possible to specify positions greater than or equal to 360°, in order to perform additional full turns.

Special cases

Particular attention should be paid to the behavior when requesting one or more complete modulo rotations. No movement is performed if the axis is at an exact set position of 90° and is positioned at 90°, for example. If 450° in positive direction is requested, the axis performs one rotation. The behavior can be different following an axis reset, because the reset will cause the current actual position to be adopted as the set position. This means that the axis is no longer exactly at 90°, but slightly below or above this value. These cases will give rise either to a minimum positioning to 90 degrees, or on the other hand a complete rotation.

Depending on the use case, it may be more effective for complete modulo rotations to calculate the desired target position on the basis of the current absolute position, and then to position using the function block MC_MoveAbsolute.

See also: Modulo positioning

MC_MoveModulo 2: Inputs

VAR_INPUT
    Execute      : BOOL;
    Position     : LREAL; 
    Velocity     : LREAL; 
    Acceleration : LREAL; 
    Deceleration : LREAL; 
    Direction    : MC_Direction;
    Options      : ST_MoveOptions;
END_VAR 

Name

Type

Description

Execute

BOOL

The command is executed with a rising edge.

Position

LREAL

Modulo target position to be used for positioning. If the axis is started from standstill, positions greater than 360° result in additional turns. Negative positions are not permitted.

Velocity

LREAL

Maximum travel velocity (>0).

Acceleration

LREAL

Acceleration (≥0)

Deceleration

LREAL

Deceleration (≥0)

Direction

MC_Direction

Positive or negative direction of travel (type MC_Direction). If the axis is started during a motion, the direction may not be reversed.

Options

ST_MoveOptions

Data structure (ST_MoveOptions) containing additional, rarely used parameters. The input can normally remain unused.

MC_MoveModulo 3:

See also: General rules for MC function blocks.

MC_MoveModulo 4: Inputs/outputs

VAR_IN_OUT
    Axis : AXIS_REF;
END_VAR

Name

Type

Description

Axis

AXIS_REF

Axis data structure that unambiguously addresses an axis in the system. Among other parameters it contains the current axis status, including position, velocity or error state.

MC_MoveModulo 5: Outputs

VAR_OUTPUT
    Done           : BOOL;
    Busy           : BOOL;
    Active         : BOOL;
    CommandAborted : BOOL;
    Error          : BOOL;
    ErrorID        : UDINT;
END_VAR

Name

Type

Description

Done

BOOL

TRUE when the target position has been reached.

Busy

BOOL

TRUE as soon as the command is started with "Execute" and as long as the movement command is processed. If "Busy" is FALSE, the function block is ready for a new order. At the same time, one of the outputs "Done", "CommandAborted" or "Error" is set.

Active

BOOL

Indicates that the command is executed. If the command was buffered, it becomes active once a running command is completed.

CommandAborted

BOOL

TRUE if the command could not be executed completely. The axis was stopped or the current command was replaced by another Move command.

Error

BOOL

TRUE, if an error occurs.

ErrorID

UDINT

If the error output is set, this parameter supplies the error number.

MC_MoveModulo 6:

See also: General rules for MC function blocks.