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

FB_GET_ATTRIBUTE_SINGLE 2: Inputs

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

Name

Type

Description

sNetId

T_AmsNetID

AMSNetId of the TwinCAT EtherNet/IP™ scanner via which the command is to run

sIPv4Addr

T_IPv4Addr

IP address of the target device.

bExecute

BOOL

A positive edge starts the command.

nClass

WORD

Class number of the CIP service

nInstance

WORD

Instance number of the CIP service

nAttribute

WORD

Attribute number of CIP service

pDst

POINTER OF BYTE

Pointer to the variable into which the value is to be copied (get the pointer with ADR)

nMaxLen

WORD

Size of the variable to which the pointer pDst points (get with SizeOf)

nSessionTimeoutMSec

DWORD

Timeout for the session; the default is 30 seconds

nCmdTimeoutMSec

DWORD

Timeout for the command; the default is 7.5 seconds

bRackComm

BOOL

TRUE if the CPU is modular, i.e. a CPU with a rack design, for example a CompactLogix

nPort

BYTE

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

nSlot

BYTE

Slot number if the CPU is not plugged into slot 0

FB_GET_ATTRIBUTE_SINGLE 3: Outputs

VAR_OUTPUT
    bBusy     : BOOL;
    bError    : BOOL;
    nErrId    : UDINT;
    nDataLen  : WORD;
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. While Busy = TRUE, no new command will be accepted at the inputs.

bError

BOOL

If an error occurs during the transfer of the command, then this output is set once the bBusy output was reset.

nErrId

UDINT

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

nDataLen

WORD

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