FB_SoEWriteCommandControl
With the FB_SoEWriteCommandControl function block a command can be prepared, started or canceled.
Inputs
VAR_INPUT
NetId : T_AmsNetID := '';
Idn : WORD;
CmdControl : E_SoE_CmdControl;
Execute : BOOL;
Timeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
Name | Type | Description |
---|---|---|
NetId | T_AmsNetID | String which contains the AMS Network ID of the PC (type: T_AmsNetId). |
Idn | WORD | Parameter number that FB_SoEWriteCommandControl refers to, e.g. "P_0_IDNs + 160" for P-0-0160. |
CmdControl | E_SoE_CmdControl | Indicates whether a command should be prepared (eSoE_CmdControl_Set := 1), executed (eSoE_CmdControl_SetAndEnable := 3), or aborted (eSoE_CmdControl_Cancel := 0). |
Execute | BOOL | The function block is enabled via a positive edge at this input. |
Timeout | TIME | Maximum time allowed for the execution of the function block. |
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
Busy : BOOL;
Error : BOOL;
AdsErrId : UINT;
SercosErrId : UINT;
END_VAR
Name | Type | Description |
---|---|---|
Busy | BOOL | This output is set when the function block is activated, and remains set until a feedback is received. |
Error | BOOL | This output is set after the Busy output has been reset when an error occurs in the transmission of the command. |
AdsErrId | UINT | In the case of a set Error output returns the ADS error code of the last executed command. |
SercosErrId | UINT | In the case of a set Error output returns the Sercos error of the last executed command. |
Sample
fbWriteCommandControl : FB_SoEWriteCommandControl;
WriteCommandControl : BOOL;
Idn : WORD;
CmdControl : E_SoE_CmdControl;
(* NcAxis *)
Axis : AXIS_REF;
IF WriteCommandControl THEN
Idn := P_0_IDNs + 160;
fbWriteCommandControl(
Axis := Axis,
Execute := TRUE,
Timeout := DEFAULT_ADS_TIMEOUT,
Idn := Idn,
CmdControl := CmdControl
);
IF NOT fbWriteCommandControl.Busy THEN
fbWriteCommandControl(Axis := Axis, Execute := FALSE);
WriteCommandControl := FALSE;
END_IF
END_IF