FB_SoEWrite
With the FB_SoEWrite function block a parameter can be written.
Inputs
VAR_INPUT
NetId : T_AmsNetID := '';
Idn : WORD;
Element : BYTE;
SrcBuf : PVOID;
BufLen : UDINT;
Execute : BOOL;
Timeout : TIME := DEFAULT_ADS_TIMEOUT;
Password : ST_SoE_String;
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_SoERead refers to, e.g. "S_0_IDNs + 47" for S-0-0047, see AX5000 Idn description. |
Element | BYTE | Specifies which part of the parameter should be accessed, e.g. 16#40 is the value (Value) of the parameter. Usually there is only write access to the value, other components of the parameter are read-only.
|
SrcBuf | PVOID | ADR() of the variable containing the value to be written. |
BufLen | UDINT | SIZEOF() of the variables that the value should be read to. |
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. |
Password | ST_SoE_String | Password as Sercos string. Currently not used. The password must be written with FB_SoEWritePassword. |
The Idns can be taken from the corresponding drive documentation. For the AX5000 from Beckhoff see AX5000 Idn description. |
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 | UDINT | In the case of a set Error output returns the Sercos error of the last executed command. |
Sample
fbWrite : FB_SoEWrite;
Idn : WORD;
Write : BOOL;
WriteValue : UINT;
Password : ST_SoE_String;
(* NcAxis *)
Axis : AXIS_REF;
IF Write THEN
Idn := S_0_IDNs + 33;
fbWrite(
Axis := Axis,
Idn := Idn,
Element := 16#40,
pSrcBuf := ADR(WriteValue),
BufLen := SIZEOF(WriteValue),
Password := Password,
Execute := TRUE,
Timeout := DEFAULT_ADS_TIMEOUT,
);
IF NOT fbWrite.Busy THEN
fbWrite(Axis := Axis, Execute := FALSE);
Write := FALSE;
END_IF
END_IF
Parameter access
Note that for some parameters, the additional items of information "ActualLength" & "MaxLength" are necessary for the parameter access.
In order to determine the parameters for which this is necessary, the attributes can be displayed in the parameter list of the Drive Manager via the context menu of the header.
If the fifth place from the right contains the value 4, 5, 6 or 7, then the additional items of information are also transmitted.
The structure to read out the serial number (S-0-0432) then looks like this:
TYPE ST_SerialNumber:
STRUCT
ActualLength : UINT;
MaxLength : UINT;
SerialNumber : T_MaxString;
END_STRUCT
END_TYPE