logRead (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


logRead is used for reading entries in the Datalogger. It will return the record from the current read position.

To read from file- or memory-based Dataloggers, please use logReadRaw.

 

Input:

None

 

Output:

tag : SINT

Tag value for the record.  

 

year : SINT

Year value from the timestamp.  

 

month : SINT

Month value from the timestamp.  

 

day : SINT

Date value from the timestamp.  

 

hour : SINT

Hour value from the timestamp.  

 

minute : SINT

Minute value from the timestamp.  

 

second : SINT

Second value from the timestamp.  

 

linsec : DINT

The timestamp in seconds since 1980-1-1 00:00:00.

 

value : ARRAY [1..8] OF DINT

Value for each of the up to 8 separate values logged in the record.

 

status : SINT

0

- Successful.

1

- Unspecified error.

2

- Log empty (no records available).

4

- Log is not initialized.

6

- Invalid read position. (log has been cleared)

 

Declaration:

FUNCTION_BLOCK logRead;
VAR_OUTPUT
  tag   : SINT;               | Tagvalue for the record
  year   : INT;                 | 1980..2048
  month : SINT;               | 1..12
  day   : SINT;               | 1..31
  hour   : SINT;               | 0..23
  minute : SINT;               | 0..59
  second : SINT;               | 0..59
  linsec : DINT;               | Time in seconds since 1980-1-1 00:00:00
  value : ARRAY[1..8] OF DINT; | Upto 8 values for the record
  status : SINT;               | status
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  LogReader : logRead; // Declare an instance of the LogRead functionblock
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  logFirst();
  LogReader(); // Read the logentry
  // LogReader.tag contains the tagvalue
  // LogReader.value[1] contains the first value
  // LogReader.year contains the year from the timestamp
  // etc etc
  ...
END;
END_PROGRAM;