Interruption and Continuation of Movements
While an axis group is in motion, the movement can be stopped. This can be an intentional stop (MC_GroupHalt
, MC_GroupStop
), or a pause on the path (MC_GroupInterrupt
), or a halt due to an error. In all cases, CODESYS SoftMotion provides function blocks to move the axis group back to the planned path and continue it.
Stopping a movement by pausing
You can use the MC_GroupInterrupt
and MC_GroupInterruptAt
function blocks to interrupt the execution of the commanded movements. For MC_GroupInterrupt
, an immediate stop is executed. For MC_GroupInterruptAt
, a stop is executed at a specific position. Then the movement can be resumed later with MC_GroupContinue
.
The function block MC_GroupInterruptAt
provides the input SMC_GroupInterruptPositionMvtRel
. This specifies an interrupt position relative to a movement. The movement is referenced by its SMC_Movement_Id
. The position within the movement is defined by a value (real) between 0 and 1, where 0 is the beginning of the movement and 1 is the end. A position between the points B and A is interpreted exactly as if there were no blending. A position between Pstart and B or between A and Pdest is projected on the blending path.

When the specified movement ID is unknown, the function block returns an error. The running movement is not interrupted.
If the current dynamic state of the axis group does not allow reaching the standstill before the specified interrupt position, then
SMC_GroupInterruptAt
behaves exactly likeMC_GroupInterrupt
: the interruption is executed immediately and the axis group reaches the standstill somewhere behind the commanded interrupt position.All other errors are handled exactly like for
MC_GroupInterrupt
.
An interrupt at a specific position can be aborted with another movement as long as the process of stopping at the interrupt position has not started yet.
Only one interrupt can be commanded at a specific position at the same time. If an interrupt has been commanded, then it has to be either completed or aborted so that another interrupt can be accepted.
When you execute MC_GroupInterrupt
or MC_GroupInterruptAt
, a path-invariant stop is executed at first, similar to an MC_GroupHalt
. Then the state of the axis group ("continue data") is stored in a variable transferred by the user (type SMC_AXIS_GROUP_CONTINUE_DATA
). Now the axis group is in the state GroupStandby
and can be used normally. A typical example would be that the axis group is jogged.
Later, you can use MC_GroupContinue
to continue the interrupted execution. To do this, transfer the saved "continue data". For this to work without errors, the position of the axis group has to match the position it had after execution of MC_GroupInterrupt
. (See SMC_GroupGetContinuePosition
.)
When a tracking movement has been interrupted (meaning a movement that was commanded relative to a dynamic coordinate system), MC_GroupInterrupt
does not stop absolutely (like MC_GroupHalt
), but relatively to the dynamic coordinate system. For example, if a workpiece is tracked on a rotary table, MC_GroupInterrupt
halts with respect to the workpiece. The axis group continues to follow the workpiece. The continue data has to get updated with SMC_GroupUpdateContinueData
if the kinematic has rotary axes with multiple periods. Afterwards, the movement can be continued with MC_GroupContinue
.
Important
The variable of type SMC_AXIS_GROUP_CONTINUE_DATA
must not be stored persistently or changed during an online change.
Tip
Using the function block SMC_GroupWait
, you can wait on the path between two movements for a programmable time.
Movement stop via MC_GroupHalt or MC_GroupStop
After a movement stop triggered by MC_GroupHalt
or MC_GroupStop
, the movement of the axis group can be continued by using SMC_GroupSaveContinueData
and MC_GroupContinue
without any loss of information. This POU saves the current status, the current position, and all commanded movements. As a result, the movement can be continued later from exactly this position.
Behavior before version 4.12.0.0: The SMC_GroupSaveContinueData
function block has to be called in the same cycle where MC_GroupHalt
or MC_GroupStop
is called. At this time, you need to make sure that SMC_GroupSaveContinueData
is called before MC_GroupHalt
or MC_GroupStop
. Otherwise, the aborted movements will be removed from the queue.
Behavior as of version 4.12.0.0: The SMC_GroupSaveContinueData
function block can be called at any time up to the first movement after calling MC_GroupHalt
or MC_GroupStop
. The continuation position is the current axis group position at the time of the first call of the function block. The saved path consists of all movements which have been accepted before the halt/stop command.
To be able to continue the path at the position where the axis group stopped due to MC_GroupHalt
or MC_GroupStop
, SMC_GroupSaveContinueData
should be called in the cycle where MC_GroupHalt
or MC_GroupStop
sets the Done
signal.
Only one instance of SMC_GroupSaveContinueData
may be called per axis group.
Tip
Saving the current status before the halt/stop command may take several cycles, but it is guaranteed that the status information in the first cycle will be saved before any interrupted movements.
Tip
SMC_GroupSaveContinueData
can be called at any time to save the current state, not only in connection with calling MC_GroupHalt
or MC_GroupStop
.
Stopping a movement due to an error
If a movement is stopped in motion due to an error, then the individual axes of an axis group are halted individually and switched to the error state. In the process, the TCP leaves the planned path. Now you can acknowledge the error, reset the axis group, and move to the position where the error was detected. Afterwards, you can instruct the axis group to continue the previously planned movements.
You use the SMC_GroupEnableResumeAfterError
function block to enable the function to resume the programmed movements after an error. The function block has to be called cyclically in the bus cycle task. Only one instance of this function block may be called per axis group.
If the axis group detects an error and switches to the state Errorstop
, then it saves the already accepted movements and the necessary status information in a variable of type SMC_AXIS_GROUP_CONTINUE_DATA
. Then this variable contains the "continue data" and is passed as an input of SMC_GroupEnableResumeAfterError
.
This allows you to resume the movements later using MC_GroupContinue
. If the errors are caused by the commanded movements (for example, workspace violations or an invalid arc radius), then they cannot be resolved in this way. These errors will occur again after the movement continues. The mechanism is intended more for single-axis errors and other external events that force the axis group into the error stop.
MC_GroupContinue
requires the axis group to be at a specific position when continuing the movement. In case of resuming after an error, this position is the current position at the time the error was detected. You can use the SMC_GroupGetContinuePosition
function block to get this position.
Important
If an axis group error does not allow the continuation of the movement (such as an internal error when writing the continue data), then
MC_GroupContinue
andSMC_GroupGetContinuePosition
return the new error IDSMC_AXIS_GROUP_CONTINUE_DATA_NOT_WRITTEN
.If an
MC_GroupStop
is active when the error occurs, thenMC_GroupStop
is also reactivated when the movement continues. The axis group has already been stopped, and theMC_GroupStop
has deleted all pending movements so that no movement occurs.When an axis group error occurs, the function block instance of the active movement issues the error (outputs
Active
andBusy
switch toFALSE
, and outputError
switches toTRUE
). The function block instances of buffered or blended movements, which have not become active yet, also issue an error. After restarting, all of these function block instances are reset toBusy
/Active
and their outputs reset toError
/CommandAborted
.