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. (Type: T_AmsNetId)

nPort

UINT

Fixed address of the EtherCAT device

sPathName

T_MaxString

Path name ( e.g.: 'c:\TwinCAT\FOE\Data.fwp' )
(See sPathName)

dwPass

DWORD

Password

eMode

E_EcFoe
Mode

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

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

Via the global boolean variable:
Tc2_EtherCAT.bEcFoeOpenFileNameWithFileExt
the use of the file name extension can be enabled or disabled for all instances of the FB_EcFoeOpen function block. By default, the variable has the value FALSE (no file name extension). If you set the value to TRUE then the use of file name extensions is enabled.
Note that the FoE function blocks were originally used for firmware updates where no file name 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