FB_SET_ATTRIBUTE_SINGLE

FB_SET_ATTRIBUTE_SINGLE 1:

The function block FB_SET_ATTRIBUTE_SINGLE enables writing of parameters in an EtherNet/IP device.

Service Code: 0x10

FB_SET_ATTRIBUTE_SINGLE 2: Inputs

VAR_INPUT
    sNetId               : T_AmsNetID;
    sIPv4Addr            : T_IPv4Addr;
    bExecute             : BOOL;
    nClass               : WORD;
    nInstance            : WORD;
    nAttribute           : WORD;
    pSrc                 : POINTER TO BYTE;
    nSrcDataLen          : 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

pSrc

POINTER TO BYTE

Pointer to the variable that contains the value for sending the service (get the pointer with ADR)

nSrcDataLen

WORD

Size of the variable to which the pointer pSrc 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_SET_ATTRIBUTE_SINGLE 3: Outputs

VAR_OUTPUT
  bBusy    : BOOL;
  bError   : BOOL;
  nErrId   : UDINT;
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.