FB_EcFoeOpen

FB_EcFoeOpen 1:

This function block is used to open the communication port for the “File access over EtherCAT” mailbox protocol.

FB_EcFoeOpen 2: Inputs

VAR_INPUT
    sNetId    : T_AmsNetId;
    nPort     : UINT;     
    sPathName : T_MaxString;
    dwPass    : DWORD;
    eMode     : E_EcFoeMode;
    bExecute  : BOOL; 
    tTimeout  : TIME := DEFAULT_ADS_TIMEOUT; 
END_VAR

Name

Type

Description

sNetId

T_AmsNetId

String containing the AMS network ID of the EtherCAT master device.

nPort

UINT

Fixed address of the EtherCAT device

sPathName

T_MaxString

File path name ( e.g.: 'c:\TwinCAT\FOE\Data.fwp' )
(See below for further explanations of sPathName.)

dwPass

DWORD

Password

eMode

E_EcFoeMode

Access mode (write/read access)

bExecute

BOOL

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

tTimeout

TIME

Maximum time allowed for the execution of the function block.

sPathName

By default, only the filename (without filename extension) is extracted from the file path (e.g. 'c:\TwinCAT\FOE\Data.fwp') that was entered and used as the filename for the FoE protocol (in our example: 'Data'). From library version 3.3.12.0, filenames including the filename extension can also be used (in our example: 'Data.fwp').

Via the global boolean variable
Tc2_EtherCAT.bEcFoeOpenFileNameWithFileExt
the use of the filename extension can be enabled or disabled for all instances of the FB_EcFoeOpen function block. By default, the variable has the value FALSE (no filename extension). If you set the value to TRUE then the use of filename extensions is enabled.
Note that the FoE function blocks were originally used for firmware updates where no filename extension was used. If you want to update the firmware, you may have to make sure that the global variable has its original default value, i.e. FALSE.

FB_EcFoeOpen 3: Outputs

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

hFoe

T_HFoe

"File access over EtherCAT" handle

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_EtherCAT