ADSRDSTATE

ADSRDSTATE 1:

This block permits the state of an ADS device to be requested.

VAR_INPUT

VAR_INPUT
    NETID       : T_AmsNetId;
    PORT        : T_AmsPort;
    RDSTATE     : BOOL;
    TMOUT       : TIME;
END_VAR

NETID : Is a string containing the AMS network identifier of the target device to which the ADS command is directed. 

PORT : Contains the port number of the ADS device.

RDSTATE : The ADS command is triggered by a rising edge at this input.

TMOUT : States the time before the function is cancelled.

VAR_OUTPUT

VAR_OUTPUT
    BUSY        : BOOL;
    ERR         : BOOL;
    ERRID       : UDINT;
    ADSSTATE    : UINT;
    DEVSTATE    : UINT;
END_VAR

BUSY : This output remains TRUE until the block has executed a command, but at the longest for the duration supplied to the ‘Timeout’ input. While Busy = TRUE, no new command will be accepted at the inputs. Please note that it is not the execution of the service but its acceptance whose time is monitored.

ERR : This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in ‘ErrorId’. If the block has a timeout error, ‘Error’ is TRUE and ‘ErrorId’ is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

ERRID : Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs.

ADSSTATE : Contains the state identification code of the ADS target device. The codes returned here are specified for all ADS servers:

DEVSTATE : Contains the specific state identification code of the ADS target device. The codes returned here are supplementary information specific to the ADS device.

 

Example of calling the block in FBD:

ADSRDSTATE 2:

In this example the PLC run-time system 1 (port no. 801) on the computer with network address ‘1.1.1.2.7.1’ is asked about its state. The answer is adsState = 1 (IDLE) without supplementary code devState=0.

Requirements

Development environment

Target system type

PLC libraries to include

TwinCAT v2.7.0

PC or CX (x86)

PLCSystem.Lib

TwinCAT v2.8.0

PC or CX (x86)

TcSystem.Lib

TwinCAT v2.10.0 Build >= 1301

CX (ARM)

TcSystem.Lib