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

VAR_INPUT

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

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
pSrc: Pointer to the variable containing the value for sending the service (the pointer is determined with ADR)
nSrcDataLen: Size of the variable to which the pointer pSrc 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;
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.