logRewriteRaw (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

ALL

Firmware version:

1.50.00


logRewriteRaw is used to change an entry in the Datalogger. It will change both the tag and the data of the entry currently pointed to by the read pointer.

To change entries in the flash-based Datalogger, please use LogRewrite.

 

 

Input:

 

handle : SYSHANDLE

A handle to the Datalogger to change the entry in.

 

tag : SINT

The new tag value for the entry.

 

data : PTR

The new data for the entry.

 

size : DINT

The size of the new data.

 

 

Returns: INT

0

- Successful.

1

- There is not enough memory to rewrite.

2

- Log empty (no records available).

4

- Log is not initialized.

5

- The data is too large for the Datalogger.

6

- Invalid read position. (log has been cleared)

7

- The log could not be found. This function is only supported on file- and memory-based Dataloggers.

8

- The log is not writable.

10

- Failed to write to the log.

 

 

Declaration:

FUNCTION logRewriteRaw : INT;
VAR_INPUT
  handle     : SYSHANDLE;
  tag        : SINT;
  data       : PTR;
  size       : INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  handle : SYSHANDLE;
  data   : DINT := 42;
END_VAR;
BEGIN
  ...
  // Position readpointer to the first (oldest) record in the Datalogger
  logFirst(handle := handle);
  logRewriteRaw(handle := handle, tag := 2, data := ADDR(data), size := SIZEOF(data)); // Change the tag and the value for the entry currently pointed to by the readpointer
  ...
END;
END_PROGRAM;