MC_SetActualPositionOnTheFly

MC_SetActualPositionOnTheFly 1:

The actual position of an axis can be set with the function block MC_SetActualPositionOnTheFly while the axis is moving. The active travel command is adapted in order to prevent the original target being overrun.

This block is used for special reference travels, for example. A precisely measured position is detected via a hardware latch, for example. The latch supplies the current axis position at this point. Without stopping the axis, the axis position can be set to this point at a later stage by specifying the latch position as the previous reference position (PreviousPosition), in addition to the required position (ActualPosition)

Note:

Pay attention to the fact that the current set position and the target position of the current move will be shifted by the same position difference  (ActualPosition - PreviousPosition). The move will cover exactly the same distance but due to the shifted coordinate system the final position will differ from the commanded target position.

VAR_INPUT

VAR_INPUT
    Execute          : BOOL;
    ActualPosition   : LREAL;
    PreviousPosition : LREAL;
NEND_VAR

Execute : The command is executed with rising edge.

ActualPosition : Actual position to be set.

PreviousPosition : Previous position that corresponds with the new actual position.

VAR_OUTPUT

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

Done : Becomes TRUE, if the command was issued successfully.

Busy : Becomes TRUE, as soon as the block is active. Busy becomes TRUE with a rising edge at Execute and becomes FALSE again after the block finished or aborted its operation. A rising edge at Execute will then be accepted.

CommandAborted : Becomes TRUE if the task is interrupted.

Error: Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set.

VAR_IN_OUT

VAR_IN_OUT
    Axis : NCTOPLC_AXLESTRUCT;
END_VAR

Axis : Axis structure.

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.10 Build 1251

PC (i386)

TcMC.Lib