FB_EcCoeSdoWriteEx

FB_EcCoeSdoWriteEx 1:

The FB_EcCoeSdoWrite function block permits an object from the object directory of an EtherCAT slave to be written by means of an SDO download. This requires the slave to have a mailbox and to support the "CANopen over EtherCAT" (CoE) protocol. The nSubIndex and nIndex parameters select the object the data should be written to. Via bCompleteAccess := TRUE the parameter is being written with all sub indexes.

VAR_INPUT

VAR_INPUT
    sNetId          : T_AmsNetId; (* AmsNetId of the EtherCAT master device.*)
    nSlaveAddr      : UINT; (* Address of the slave device.*)
    nSubIndex       : BYTE; (* CANopen Sdo subindex.*)
    nIndex          : WORD; (* CANopen Sdo index.*)
    pSrcBuf         : DWORD; (* Contains the address of the buffer containing the data to be send. *)
    cbBufLen        : UDINT; (* Contains the max. number of bytes to be received. *)
    bExecute        : BOOL; (* Function block execution is triggered by a rising edge at this input.*)
    tTimeout        : TIME := DEFAULT_ADS_TIMEOUT;(* States the time before the function is cancelled. *)
    bCompleteAccess : BOOL; (* access complete object*)
END_VAR

sNetId: This is a string that contains the AMS network identifier of the EtherCAT master device.

nSlaveAddr: Fixed address of the EtherCAT slave to which the SDO download command should be sent.

nSubIndex:Sub-index of the object that should be written to.

nIndex: Index of the object that should be written to.

pSrcBuf:Address (pointer) of the send buffer.

cbBufLen:Number (in bytes) of data to be sent.

bExecute: The block is activated by a rising edge at this input.

tTimeout: Maximum time allowed for the execution of the function block.

bCompleteAccess: With bCompleteAccess := TRUE the complete parameter with all sub indexes is being written.

VAR_OUTPUT

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

bBusy: This output is set when the function block is activated, and remains set until an acknowledgement is received.

bError: This output is set up after the bBusy output has been reset if there has been an error in transmission of the command.

nErrId: Supplies the ADS error code associated with the most recently executed command if the bError output is set.

Requirements

Development environment

Target system type

Libraries to be linked

TwinCAT v2.10.0 Build >= 1319 or higher

PC or CX (x86)

TcEtherCAT.Lib
( Standard.Lib; TcBase.Lib; TcSystem.Lib, TcUtilities.Lib are included automatically )

TwinCAT v2.10.0 Build >= 1319 or higher

CX (ARM)