TwinCAT 3 PLC Lib: Tc2_MC2



MC_MoveVelocity starts a continuous movement with specified velocity and direction. The movement can be stopped through a Stop command.

The InVelocity output is set once the constant velocity is reached. Once constant velocity has been reached, the block function is complete, and no further monitoring of the movement takes place. If the command is aborted during the acceleration phase, the output "CommandAborted" or, in the event of an error, the output "Error" is set.

Motion commands can be applied to coupled slave axes, if this option was explicitly activated in the axis parameters. A motion command such as MC_MoveAbsolute then automatically leads to uncoupling of the axis, after which the command is executed. In this case the only available BufferMode is "Aborting".



    Execute      : BOOL; (* B *)
    Velocity     : LREAL; (* E *)
    Acceleration : LREAL; (* E *)
    Deceleration : LREAL; (* E *)
    Jerk         : LREAL; (* E *)
    Direction    : MC_Direction := MC_Positive_Direction; (* E *)
    BufferMode   : MC_BufferMode; (* E *)
    Options      : ST_MoveOptions; (* V *)

Execute: The command is executed with a positive edge.

Velocity: Maximum travel speed (>0).

Acceleration: Acceleration (≥0). If the value is 0, the standard acceleration from the axis configuration in the System Manager is used.

Deceleration: Deceleration (≥0). If the value is 0, the standard deceleration from the axis configuration in the System Manager is used.

Jerk: Jerk (≥0). At a value of 0, the standard jerk from the axis configuration in the System Manager is applied.

Direction: Positive or negative direction of travel (type: MC_Direction).

BufferMode: Is evaluated if the axis already executes another command (type: MC_BufferMode). MC_MoveVelocity becomes active after the current command or aborts it. Transition conditions from the current to the next command are also determined by the BufferMode. If the command is applied to a coupled slave axis, only the BufferMode "Aborting" is possible. A second function block is always required to use the BufferMode. It is not possible to trigger a move function block with new parameters while it is active.

Options: Data structure containing additional, rarely used parameters. The input can normally remain open.



    InVelocity     : BOOL; (* B *)
    Busy           : BOOL; (* E *)
    Active         : BOOL; (* E *)
    CommandAborted : BOOL; (* E *)
    Error          : BOOL; (* B *)
    ErrorID        : UDINT; (* E *)

InVelocity: TRUE as soon as the constant velocity is reached and FALSE if the velocity deviates.

The function block remains "Busy" and "Active" until a new command is issued.

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

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

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

Error: TRUE, if an error occurs.

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



    Axis : AXIS_REF;

Axis: 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. (Type: AXIS_REF)



Development environment
Target system type
PLC libraries to include
TwinCAT v3.0.0
PC or CX (x86)