
PLC programming
Library
FILE IO functions
8
8.8
8.8.3
l
384
EDSTCXN EN 2.0
8.8.3.3 SetCurrentPath
FUNCTION SetCurrentPath: DINT
VAR_INPUT
path_s : STRING(40); (* device name and path *)
END_VAR
Defines the actual default drive and the directory path for the file IO
functions of the device drivers (¶ 390). With the directory path the IP
address of the CNC data server (network disk) can be defined.
Return value: The function returns an error code (¶ 391).
SetCurrentPath(’ND:172.16.5.66’);
8.8.3.4 SYSOPENFILE
FUNCTION SYSOPENFILE : DINT
VAR_INPUT
filename_s : STRING(15);
accessmode_di : DINT;
END_VAR
The function is used to open a file on the defined device (¶ 390). It returns
a file handle which is required for the functions SysReadFile() and
SysWriteFile(). A total of 4 files can be opened simultaneously.
filename_s: Name of the file to be opened. Optionally with preceding device ID and
colon.
accessmode_di: Access mode O_RDONLY or O_WRONLY (defined in gobal constants)
Return value: file handle (greater or equal to 0 if successful, less than 0 in
case of an error (¶ 391).
handle_di : DINT;
handle_di := SYSOPENFILE(’RD:data.dat’, O_RDONLY);
Declaration
Description
Example
Declaration
Description
Parameters
Example
rasha