Plc programming – Lenze ETC Motion Control User Manual
Page 388
PLC programming
Library
FILE IO functions
8.8
8.8.3
l
388
EDSTCXN EN 2.0
8.8.3.11
SYSFIRSTFILE, SYSNEXTFILE
FUNCTION SYSFISRTFILE: DINT
VAR_INPUT
info_p
: DINT;
(* Address of a variable of type FILEINFO_TR *)
pattern_s
: STRING(15);
(* search pattern *)
END_VAR
FUNCTION SYSNEXTFILE: DINT
VAR_INPUT
info_p
: DINT;
(* Address of a variable of type FILEINFO_TR *)
pattern_s
: STRING(15);
(* search pattern *)
END_VAR
These functions are required to read the file list of the FLASHPROM, the RAM
disk or the FLOPPY. With SysFirstFile() the stated file info structure is
intialised and the information for the first file stored in structure. All
subsequent calls of SysNextFile(), with the same file info structure, store the
information of the next file in sequence in the structure.
The file info structure is structured as follows:
TYPE FILEINFO_TR
STRUCT
filename_s
: STRING(15); (* file name *)
filesize_dw
: DWORD; (* file size in byte *)
filenum_di
: DINT; (* No. of the directory entry *)
END_STRUCT
END_TYPE
info_p:
Pointer to the file info structure where the file name and the file length
are to be stored.
pattern_s:
Search pattern with MS−DOS wild cards. Each time the next file whose
file name matches the pattern will be returned.
Return value: 0, if OK.. DSK_FILE_NOT_EXIST_KDI, if no further files
available. All other values indicate an error (all errors are defined in the
global constants of the library).
info_st
: FILEINFO_TR;
err_di
DINT;
err_di = SYSFIRSTFILE(ADR(info_st), ’SD:*.DIN’); (* fetch info on the first file *)
err_di = SYSNEXTFILE(ADR(info_st), ’SD:*.DIN’); (* fetch info on the next file *)
Declaration
Description
Parameters
Example