FB_GetAdaptersInfoEx
This function block can be used to read adapter information for a TwinCAT PC. The maximum number of adapter information read is limited to 64.
After a successful call, the read process is finished and the read adapter information can be copied using the Get() method.
Inputs
VAR_INPUT
sNetID : T_AmsNetID;
bExecute : BOOL;
tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
Name | Type | Description |
---|---|---|
sNetID | T_AmsNetID | A string with the network address of the TwinCAT computer whose adapter information is to be read can be specified here. For the local computer an empty string may be specified. |
bExecute | BOOL | The function block is enabled by a positive edge at this input. |
tTimeout | TIME | States the length of the timeout that may not be exceeded by execution of the ADS command. |
Outputs
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
nErrorID : UDINT;
nAdapters : UINT;
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | When the function block is enabled, this output is set and remains set until a feedback is received. |
bError | BOOL | If an error occurs during the transmission of the command, this output is set after the bBusy output is reset. |
nErrorID | UDINT | Returns the ADS error number when the bError output is set. |
nAdapters | UDINT | Number of local adapters that were found. Their adapter information has been read and can be copied using the Get() method. |
Get() method
Once the function block has been called successfully, the read operation is complete and the adapter information read can be copied using the Get() method.
It is possible to copy the information of all adapters together. Likewise, the information per adapter can be copied individually one after the other.
When called, a local array (type: ST_IpAdapterInfo) is specified. Each array element thus returns information of an adapter.
METHOD Get : BOOL
VAR_INPUT
pAdapters : POINTER TO ST_IpAdapterInfo; // pointer to array of adapter info (variable array length)
nAdaptersSize : UDINT; // size in bytes of array of adapter info
END_VAR
Requirements
Development environment | Target platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.4024 | PC or CX (x86, x64, ARM) | Tc2_Utilities (System) >= 3.3.48.0 |