FB_EcCoeSdoReadEx

FB_EcCoeSdoReadEx 1:

The FB_EcCoeSdoReadEx function block allows data to be read from an EtherCAT slave through an SDO (Service Data Object) access. 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 that is to be read. The parameter can be read with all sub indexes via bCompleteAccess := TRUE.

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.*)
    pDstBuf         : DWORD; (* Contains the address of the buffer for the received data. *)
    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 upload command should be sent.

nSubIndex:Sub-index of the object that is to be read.

nIndex: Index of the object that is to be read.

pDstBuf:The address (pointer) of the receive buffer.

cbBufLen:The maximum available buffer size for the data to be read, in bytes.

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 read.

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)