FB_GET_ATTRIBUTE_SINGLE

FB_GET_ATTRIBUTE_SINGLE 1:

The function block FB_GET_ATTRIBUTE_SINGLE enables reading of parameters from an EtherNet/IP device.

Service code: 0x0E

VAR_INPUT

VAR_INPUT
    sNetId               : T_AmsNetID;
    sIPv4Addr            : T_IPv4Addr;
    bExecute             : BOOL;
    nClass               : WORD;
    nInstance            : WORD;
    nAttribute           : WORD;
    pDst                 : POINTER TO BYTE;
    nMaxLen              : WORD;
    nSessionTimeoutMSec  : DWORD;
    nCmdTimeoutMSec      : DWORD;
    bRackComm            : BOOL;
    nPort                : BYTE;
    nSlot                : BYTE;
END_VAR

sNetId: AMSNetId of the TwinCAT EtherNet/IP scanner through which the command is to run

sIPv4Addr: IP address of the target device

bExecute: A positive edge starts the command

nClasss: Class number of the CIP service

nInstance: Instance number of the CIP service

nAttribut: Attribute number of CIP service

pDst: Pointer to the variable to which the value is be copied (the pointer is determined with ADR)

nMaxLen: Size of the variable to which the pointer pDst points (determined with SizeOf)

nSessionTimeoutMSec: Timeout for the session; the default is 30 seconds

nCmdTimeoutMSec: Timeout for the command; the default is 7.5 seconds
bRackComm: TRUE if the CPU is modular, i.e. a CPU with a rack design, for example a CompactLogix

nPort: Port number of the CPU (the TF6281 currently only supports port 1)

nSlot: Slot number if the CPU is not plugged into slot 0

VAR_OUTPUT

VAR_OUTPUT
    bBusy     : BOOL;
    bError    : BOOL;
    nErrId    : UDINT;
    nDataLen  : WORD;
END_VAR

bBusy: When the function block is activated this output is set. It remains set until a feedback is received. While Busy = TRUE, no new command will be accepted at the inputs.

bError: If an error should occur during the transfer of the command, then this output is set once the bBusy output was reset.

nErrId: If an bError output is set, this parameter supplies an error number.

nDataLen: Returns the number of valid data (number of bytes).