FB_SoERead
With the FB_SoERead function block a parameter can be read.
By default, attributes and values are read in parallel.
Should the call generate an ADS error on a third-party device, the lack of support for this faster parameter access method may be the cause.
In this case, the FB_SoESetDataAccessMode function block can be used to switch to the slower sequential access method, if required.
Inputs
VAR_INPUT
NetId : T_AmsNetID := '';
Idn : WORD;
Element : BYTE;
pDstBuf : PVOID;
BufLen : UDINT;
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_SoERead refers to, e.g. "S_0_IDNs + 33" for S-0-0033 |
Element | BYTE | Specifies which part of the parameter should be accessed, e.g. 16#40 is the value (Value) of the parameter.
|
pDstBuf | PVOID | ADR() of the variables that the value should be read to. |
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. |
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;
Attribute : DWORD;
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. |
Attributes | DWORD | Returns the attributes of the Sercos parameter. |
Sample
fbRead : FB_SoERead;
Read : BOOL;
Idn : WORD;
ReadValue : UINT;
(* NcAxis *)
Axis : AXIS_REF;
IF Read THEN
Idn := S_0_IDNs + 33;
fbRead(
Axis := Axis,
Idn := Idn,
Element := 16#40,
pDstBuf := ADR(ReadValue),
BufLen := SIZEOF(ReadValue),
Execute := TRUE,
Timeout := DEFAULT_ADS_TIMEOUT,
);
IF NOT fbRead.Busy THEN
fbRead(Axis := Axis, Execute := FALSE);
Read := 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