MC_ActivateExternalSetpointGeneration
This function block activates external setpoint generation. Setpoints are generated by a function block, which is called through the ITcMcExternalSetpointGenerator interface from the MC context. Additionally custom startup data can be passed through the generator.
Syntax
Definition:
FUNCTION_BLOCK MC_ActivateExternalSetpointGeneration
VAR_IN_OUT
Axis : Reference To AXIS_REF;
END_VAR
VAR_INPUT
Execute : BOOL;
ExternalSetpointGenerator : ITcMcExternalSetpointGenerator;
AllowOtherContext : BOOL;
EnableDynamicChecks : BOOL;
InvokeId : XWORD;
BufferMode : EBufferMode;
END_VAR
VAR_OUTPUT
Busy : BOOL;
Active : BOOL;
CommandAborted : BOOL;
Error : BOOL;
ErrorId : UDINT;
END_VAR
Inputs
|
Name |
Type |
Default |
Description |
|---|---|---|---|
|
Execute |
BOOL |
|
Trigger the command with rising edge. |
|
ExternalSetpointGenerator |
ITcMcExternalSetpointGenerator |
|
Function block that implements (cyclic) methods for external setpoint generation |
|
AllowOtherContext |
BOOL |
false |
Allow the calling task to differ from the MC task (MET task). When TRUE, ensure compatible update rates and safe data access in the ITcMcExternalSetpointGenerator methods. |
|
EnableDynamicChecks |
BOOL |
true |
Trigger error on inconsistent setpoint values (position, velocity, acceleration) if EnableDynamicChecks = TRUE. |
|
InvokeId |
XWORD |
0 |
Invocation identifier, passed through to the external setpoint generator. Can be used to distinguish multiple activations of the same generator, or to pass custom data (e.g. a pointer). |
|
BufferMode |
Aborting |
Chronological sequence of the command |
Outputs
|
Name |
Type |
Description |
|---|---|---|
|
Busy |
BOOL |
Function block is not finished and new output values are to be expected. |
|
Active |
BOOL |
Function block has active control on the axis. |
|
CommandAborted |
BOOL |
Command is aborted by another command. |
|
Error |
BOOL |
Error occurred within function block. |
|
ErrorId |
UDINT |
Error identifier |
Further information
Possible error codes
For this function block, the following values, among others, are possible for the ErrorId output:
Error(Hex) | Error(Dec) | Error type | Description |
|---|---|---|---|
0x813c | 33084 | Parameter | BufferMode is invalid. The BufferMode passed to the function block is unknown or not supported by the command (some commands accept only Aborting, others only Buffered). |
0x8145 | 33093 | Function Block | Mapping of cyclic interface between NC and PLC is missing (e.g., AXIS_REF, AXES_GROUP_REF, ...). A reference used by the function block (e.g., to an axis, group, mover or other motion object) is not linked to the corresponding NC object, or its cyclic mapping is incomplete. |
0x81af | 33199 | Function Block | Invalid object or object reference passed to function block. An invalid or missing object reference was passed to the function block (e.g., missing CamObject reference on MC_CamIn, MC_CamTableSelect or MC_CamScaling). |
An overview of all NC error codes can be found here:
In connection with task settings and the AllowOtherContext = FALSE input, the error ADSERR_DEVICE_INVALIDCONTEXT (0x709; 1801) may occur if the MC3 and the PLC are not called by the same task.
You can find an overview of all ADS return codes here:
Version information
- TwinCAT Standard >= v3.1.4026.23.1
- TF5500 MC3 Base >= v4.0.6