MC_SetEncoderScalingFactor

MC_SetEncoderScalingFactor changes the scaling factor for the active encoder of an axis, either at standstill or in motion.

The change can be absolute or relative. This mode is only suitable at standstill, since in absolute mode the change in scaling factor leads to a position discontinuity. In relative mode an internal position offset is adapted at the same time such that no discontinuity occurs. Please note that intervention during motion changes the actual velocity of the axis while the real velocity remains constant. Therefore only small changes can be implemented during the motion.

Inputs


VAR_INPUT
Execute       : BOOL;
ScalingFactor : LREAL;
Mode          : E_SetScalingFactorMode;
Options : ST_SetEncoderScalingOptions;
END_VAR

Execute

The command is executed with a rising edge at input Execute.

ScalingFactor

Scaling factor of the active encoder of an axis. The scaling factor is specified in physical positioning units [u] divided by the number of encoder increments.

Mode

The scaling factor can be set in absolute or relative mode (ENCODERSCALINGMODE_ABSOLUTE, ENCODERSCALINGMODE_RELATIVE).
In absolute mode counting starts at the origin of the axis coordinate system, resulting in a position discontinuity if the scaling factor is changed. In relative mode the actual position of the axis does not change. This mode is therefore also suitable for changes during motion.

Options

The data structure option includes additional, rarely required parameters. The input can normally remain open.

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.

General rules for MC function blocks

Outputs


VAR_OUTPUT
Done    : BOOL;
Busy    : BOOL;
Error   : BOOL;
ErrorID : UDINT;
Options : ST_SetPositionOptions;
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:

General rules for MC function blocks

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.