MC_MoveModulo

MC_MoveModulo 1:

This function block commands a motion to a specified modulo position.

Syntax

Definition:

FUNCTION_BLOCK MC_MoveModulo
VAR_IN_OUT
    Axis            : Reference To AXIS_REF;
END_VAR
VAR_INPUT
    Execute         : BOOL;
    Position        : LREAL;
    AdditionalTurns : UDINT;
    Velocity        : LREAL;
    Acceleration    : LREAL;
    Deceleration    : LREAL;
    Jerk            : LREAL;
    BufferMode      : EBufferMode;
    Direction       : EModuloDirection;
END_VAR
VAR_OUTPUT
    Done            : BOOL;
    Busy            : BOOL;
    Active          : BOOL;
    CommandAborted  : BOOL;
    Error           : BOOL;
    ErrorId         : UDINT;
END_VAR

MC_MoveModulo 2: Inputs

Name

Type

Default

Description

Execute

BOOL

 

Trigger the command with rising edge.

Position

LREAL

#Invalid

Commanded modulo position ([PosUnit])

AdditionalTurns

UDINT

0

Number of additional modulo turns in the commanded direction. A value > 0 requires Direction <> EModuloDirection.ShortestDistance.

Velocity

LREAL

#Invalid

Maximum velocity ([PosUnit]/s, positive)

Acceleration

LREAL

#Default

Maximum acceleration ([PosUnit]/s^2, positive)

Deceleration

LREAL

#Default

Maximum deceleration ([PosUnit]/s^2, positive)

Jerk

LREAL

#Default

Maximum jerk ([PosUnit]/s^3, positive)

BufferMode

EBufferMode

Aborting

Chronological sequence of the command

Direction

EModuloDirection

ShortestDistance

Commanded direction. Must have value <> EModuloDirection.ShortestDistance if AdditionalTurns has value > 0.

MC_MoveModulo 3: In/Outputs

Name

Type

Description

Axis

Reference To AXIS_REF

Reference to the axis

MC_MoveModulo 4: Outputs

Name

Type

Description

Done

BOOL

Commanded position finally reached

Busy

BOOL

Function block is not finished and new output values are to be expected.

Active

BOOL

Function block has active control on the axis.

CommandAborted

BOOL

Command is aborted by another command.

Error

BOOL

Error occurred within function block.

ErrorId

UDINT

Error identifier

Further information

If the Direction input is set to PositiveDirection or NegativeDirection, the AdditionalTurns input is also taken into account. The AdditionalTurns input can be used to specify additional turns until the target position is reached.

Further information on Modulo positioning.

Possible error codes

For this function block, the following values, among others, are possible for the ErrorId output:

Error(Hex)

Error(Dec)

Error type

Description

0x813c

33084

Parameter

BufferMode is invalid. The BufferMode passed to the function block is unknown or not supported by the command (some commands accept only Aborting, others only Buffered).

0x8145

33093

Function Block

Mapping of cyclic interface between NC and PLC is missing (e.g., AXIS_REF, AXES_GROUP_REF, ...). A reference used by the function block (e.g., to an axis, group, mover or other motion object) is not linked to the corresponding NC object, or its cyclic mapping is incomplete.

0x8146

33094

Function Block

Invalid velocity value. The velocity was not set or the entered value is invalid.

0x8151

33105

State

Command is not allowed in current axis state. If the axis has no controller enable, is in error or has been added to a group, some commands are not permitted.

0x8182

33154

Monitoring

Software position limit violation. Software position limits of at least one axis have been or would have been violated by a command.

0x818c

33164

Parameter

Position is out of modulo range. Position must be larger or equal to zero and less or equal to the modulus when using modulo positioning. When using modulo positioning, the target position is interpreted in consideration of the AdditionalTurns variable at the Options input.

0x818d

33165

Parameter

The specified value AdditionalTurns at the Options input is not allowed. The parameter AdditionalTurns must be zero for the specified value of the parameter direction.

0x8196

33174

Initialization

Invalid position or distance. The actual or specified position or distance could not be determined or is invalid.

0x819a

33178

NC Programming

Direction-dependent feed enable is missing. The execution of this command is not possible because of a missing direction-dependent feed enable.

0x819b

33179

NC Programming

Controller enable is missing. The controller enable of the axis was withdrawn during a movement. The dynamics of the setpoint did not correspond to zero dynamics.

0x81a9

33193

Parameter

Invalid acceleration value. The supplied acceleration value is invalid (e.g. not a finite number, negative or outside the permitted range).

0x81aa

33194

Parameter

Invalid deceleration value. The supplied deceleration value is invalid (e.g. not a finite number, negative or outside the permitted range).

0x81ab

33195

Parameter

Invalid jerk value. The jerk value used for the motion is invalid (e.g., negative, zero, or outside the permitted range of the mover or axis).

0x81bc

33212

Function Block

Axis is not configured as modulo axis. The command requires a modulo axis, but the axis is not configured as a modulo axis.

An overview of all NC error codes can be found here:

Version information

  • TwinCAT Standard >= v3.1.4026.23.1
  • TF5500 MC3 Base >= v4.0.6