MC_SetPosition
MC_SetPosition sets the current axis position to a parameterizable value.
In absolute mode, the actual position is set to the parameterized absolute Position value. In relative mode, the actual position is offset by the parameterized Position value. In both cases, the set position of the axis is set such that any following error that may exist is retained. The switch Options.ClearPositionLag can be used to clear the following error.
Relative mode can be used to change the axis position during the motion.
Inputs
VAR_INPUT
Execute : BOOL;
Position : LREAL;
Mode : BOOL; (* RELATIVE=True, ABSOLUTE=False (Default)*)
Options : ST_SetPositionOptions;
END_VAR
Execute |
The command is executed with a rising edge at input Execute. | |
Position |
Position value to which the axis position is to be set. | |
Mode |
The axis position is set to an absolute value set if Mode=FALSE. Otherwise is the axis position is changed relative to the specified Position value. Relative mode can be used for changing the position of an axis during motion. | |
Options |
The data structure option includes additional, rarely required parameters. The input can normally remain open. | |
Options. |
ClearPositionLag |
ClearPositionLag can optionally be used to set the set and actual positions to the same value. In this case the following error is cancelled. |
Options. |
SelectEncoderIndex |
SelectEncoderIndex can optionally be set if an axis with several encoders is used and the position of a certain encoder is to be set (Options.EncoderIndex). |
Options. |
EncoderIndex |
EncoderIndex indicates the encoder (0 to n) if SelectEncoderIndex is TRUE. |
Outputs
VAR_OUTPUT
Done : BOOL;
Busy : BOOL;
Error : BOOL;
ErrorID : UDINT;
END_VAR
Done |
The Done output becomes TRUE, once the position was set successfully. |
Busy |
The Busy output becomes TRUE when the command is started with Execute and remains TRUE as long as the command is processed. If Busy becomes FALSE again, the function block is ready for a new job. At the same time one of the outputs, Done or Error, is set. |
Error |
Becomes TRUE if an error occurs. |
ErrorID |
If the error output is set, this parameter supplies the error number |
Inputs/outputs
VAR_IN_OUT
Axis : AXIS_REF;
END_VAR
Axis |
Axis data structure |
The axis data structure of type AXIS_REF addresses an axis uniquely within the system. Among other parameters it contains the current axis status, including position, velocity or error status.