logOpen (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

ALL

Firmware version:

1.50.00


logOpen opens an existing Datalogger from a file on the file system.

 
 

Input:

filename : STRING

The path to the file to open. If the file is not located in the B:\SYSTEM\DATALOGS\ folder, it will be opened read-only.

If no filename is provided, the handle to the default log file will be returned.

 

key : DINT

User-defined key-value. If it does not match the key stored in the datalogger, an error will be reported.

 

Output:

handle : SYSHANDLE

A handle to the opened datalogger.

 

Returns: INT

0

- Successful.

1

- Invalid filename or failed to open the file.

7

- The log could not be opened, too many logs are open.

8

- Invalid datalogger, it has the wrong key.

 

 

Declaration:

FUNCTION logOpen : INT;
VAR_INPUT
  filename   : STRING;
  key        : DINT;
  handle     : ACCESS SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  handle:SYSHANDLE;
  rc:INT;
  name: STRING := "B:\SYSTEM\DATALOGS\log.bin";
END_VAR;
BEGIN
  ...
  // Open datalogger with keyvalue 1234
  logOpen(handle:=handle, filename:=name, key:=1234);
  ...
END;
 
END_PROGRAM;