MC_SetEncoderScalingFactor
The function block MC_SetEncoderScalingFactor changes the scaling factor of 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. Note that an intervention during the motion results in a change in the actual axis velocity, 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
Name | Type | Description |
---|---|---|
Execute | BOOL | The command is executed with a rising edge. |
ScalingFactor | LREAL | 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). | |
Options | Data structure containing additional, rarely used parameters. The input can normally remain open.
|
See also: General rules for MC function blocks
Inputs/outputs
VAR_IN_OUT
Axis : AXIS_REF;
END_VAR
Name | Type | Description |
---|---|---|
Axis | Axis data structure that unambiguously addresses an axis in the system. Among other parameters it contains the current axis status, including position, velocity or error state. |
Outputs
VAR_OUTPUT
Done : BOOL;
Busy : BOOL;
Error : BOOL;
ErrorID : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
Done | BOOL | TRUE if the position was set successfully. |
Busy | BOOL | TRUE as soon as the command is started with Execute and as long as the command is processed. If "Busy" is FALSE, the function block is ready for a new order. At the same time, one of the outputs "Done" or "Error" is set. |
Error | BOOL | TRUE, if an error occurs. |
ErrorID | UDINT | If the error output is set, this parameter supplies the error number. |
See also: General rules for MC function blocks
Requirements
Development environment | Target system type | PLC libraries to include |
---|---|---|
TwinCAT v3.0.0 | PC or CX (x86 or x64) | Tc2_MC2 |