Relative Positioning with MC_MoveRelative
MC_MoveRelative is used to move an axis to a position relative to its current position. This function block will move the axis into DiscreteMotion state. MC_MoveRelative can be executed without the axis being homed.
-
A positive distance value will move in the forward direction.
-
A negative distance value will move in the negative direction.
-
LS_Connect and MC_Power must be executed before this function block can be used.
-
The examples in this topic can be found in the XMC_SingleAxis_FBs.zip downloadable from Example Applications.

Element Name | Element Type | Description |
---|---|---|
Execute | Input | Edge detected request to execute the function block. |
Axis | Input/Output | Axis reference variable. This can not be a constant. |
ContinuousUpdate | Input | Specify the update setting of the input value. This is explained in section 6.1.5 of the XMC user manual. |
Distance | Input | Specify the target distance to move. |
Velocity | Input | Specify the maximum speed of the move. |
Acceleration | Input | Specify the acceleration of the move. |
Deceleration | Input | Specify the deceleration of the move. |
Jerk | Input | Specify the change rate of acceleration and deceleration. |
BufferMode | Input | Specify the sequential operation setting. See BufferMode table below. |
Done | Output | Indicates the function block completed successfully. |
Busy | Output | Indicates the function block is currently being executed. |
Active | Output | Indicates the function block is controlling the axis. |
CommandAborted | Output | Indicates the function block was aborted. |
Error | Output | Indicates whether an error occurs or not. |
ErrorID | Output | Error Identification number. |
BufferMode Table
Sections 6.1.4 and 8.2.10 of the XMC user manual provide more information about buffer modes.
Value | Buffer Mode | Description |
---|---|---|
0 | Aborting | Abort previous command and execute the command immediately. |
1 | Buffered | Execute the command after previous command is completed. |
2 | BlendingLow | The new command is blended into a previously executed command using the lower velocity value when comparing the previous command and new command. |
3 | BlendingPrevious | The new command is blended into a previous command using the velocity of the previous command. |
4 | BlendingNext | The new command is blended into a previous command using the velocity from the new command. |
5 | BlendingHigh | The new command is blended into a previous command using the higher velocity value when comparing the previous command and new command. |

//Set axis reference
Axis1 := 1;
IF (_AX01_RDY) AND (_AX01_SV_ON) THEN
//Example of MC_MoveRelative
INST_MOVERELATIVE(Execute:=Execute_MoveRelative, Axis:=Axis1,
ContinuousUpdate:=0, Distance:=INST_MOVERELATIVE.Distance, Velocity:=INST_MOVERELATIVE.Velocity,
Acceleration:=INST_MOVERELATIVE.Acceleration,
Deceleration:=INST_MOVERELATIVE.Deceleration,
Jerk:=INST_MOVERELATIVE.Jerk, BufferMode:=0,
ErrorID=>INST_MOVERELATIVE.ErrorID);
END_IF;
LM510