FB_FTP_FileList

FB_FTP_FileList 1:

File and folder names can be read or searched from the FTP server with the function block FB_FTP_FileList. This function block uses an already opened connection to an FTP server

FB_FTP_FileList 2: Inputs

VAR_INPUT
sNetID  : T_AmsNetId := '';
hFTP     : T_HFTP;
sMask   : T_MaxString:= '';
nIndex  : UDINT;
pList   : POINTER TO ARRAY [0..MAX_FILELIST_ITEMS] OF STRING(80);
cbList  : UDINT;
bExecute: BOOL;
tTimeout: TIME       := T#20s;
END_VAR

Name

Type

Description

sNetID

T_AmsNetId

A string containing the AMS network ID of the target device, at which the ADS command is directed.

hFTP

T_HFTP

Handle of the FTP server.

sMask

T_MaxString

Search mask to filter corresponding files:

*.* Reads out all files.

* Reads out all files and all folder names.

*.txt Reads out all files with the extension "TXT".

\Test\*.* Reads out all files from the Test subfolder.

nIndex

UDINT

Specifies the index of the first filename to be read.

pList

POINTER TO ARRAY

Specifies the address of the string array into which the filenames are to be written.

cbList

UDINT

Indicates the size of the string array in bytes.

bExecute

BOOL

The function block is executed with the rising edge.

tTimeout

TIME

Indicates the timeout period.

FB_FTP_FileList 3: Outputs

VAR_OUTPUT
bBusy : BOOL;
bError: BOOL;
nErrID: UDINT;
nItems: UDINT;
END_VAR

Name

Type

Description

bBusy

BOOL

The command is in the process of being transmitted by ADS. No new command will be accepted as long as "bBusy" remains TRUE.

bError

BOOL

Becomes TRUE, as soon as an error occurs.

nErrID

UDINT

Returns the ADS error code if the bError output is set.

nItems

UDINT

Returns the total number of file list entries.

Requirements

Development Environment

Target Platform

PLC Libraries to include

TwinCAT v3.0 Build 3102

PC or CX (x86)

Tc2_FTP