FB_EcGetScannedSlaves

FB_EcGetScannedSlaves 1:

The function block FB_EcGetScannedSlaves can be used to read a list of the currently available (scanned) slaves from the EtherCAT master object directory. To this end an online scan is executed, during which the EEPROMs of the EtherCAT slaves are read. The scanning process may take some time, depending on the number of connected slaves.

FB_EcGetScannedSlaves 2: Inputs

VAR_INPUT
    bExecute               : BOOL;
    sNetId                 : T_AmsNetId; 
    pArrEcScannedSlaveInfo : POINTER TO ARRAY[0..EC_MAX_SLAVES] OF ST_EcSlaveScannedData;
    cbBufLen               : UDINT;    
    tTimeout               : TIME := DEFAULT_ADS_TIMEOUT; 
END_VAR

Name

Type

Description

bExecute

BOOL

The function block is activated by a positive edge at this input.

sNetId

T_AmsNetId

String containing the AMS network ID of the EtherCAT master device. (Type: T_AmsNetId)

pArrEcScannedSlaveInfo

POINTER TO ARRAY[0..EC_MAX_SLAVES] OF ST_EcSlaveScannedData

Address of an array of structures of type ST_EcSlaveScannedData, to which the data for each scanned slave are to be written.

cbBufLen

UDINT

Maximum available buffer size (in bytes) for the data to be read

tTimeout

TIME

Maximum time allowed for the execution of the function block.

FB_EcGetScannedSlaves 3: Outputs

VAR_OUTPUT
    bBusy   : BOOL;
    bError  : BOOL;
    nErrId  : UDINT;
    nSlaves : UINT;
ND_VAR

Name

Type

Description

bBusy

BOOL

This output is set when the function block is activated, and remains set until a feedback is received.

bError

BOOL

This output is set after the bBusy output has been reset when an error occurs in the transmission of the command.

nErrId

UDINT

Supplies the ADS error code associated with the most recently executed command if the bError output is set. Error 1798 (0x706) indicates a null pointer at the buffer address. Error 1797 (0x705) indicates inadequate buffer size.

nSlaves

UINT

Returns the number of scanned slaves.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_EtherCAT