boardFaultLogGet (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.05 / 1.00.00


The boardFaultLogGet function block is used to read the fault log from the VPL application.

The faults returned in this function block can also be read from the Fault log dialog.

 

The fault entries are sorted with the last fault first.

 
Because the fault code is a value between 1 and 255, and the SINT data type can only hold values between -128 and 127, the fault codes over 127 are returned as a negative number.

To convert a fault code returned as a negative number back to the correct value, you should use the following method:

<int> := INT(fault[n] AND 16#FF);

 

A debug feature allows information about the specific location of a fault to be retrieved. Please refer to boardFaultLogGetDebug for additional information.

See the Project settings dialog in the RTCU IDE for more information on the debug feature.

 

For a list and explanation of the fault codes, please refer to the Troubleshooting section, Fault codes.

 

Input:

None

 

Output:

count : INT;

Number of fault log entries (0..32).

 

time[n] : DINT;

Linsec for fault timestamp.

 

fault[n] : SINT;

Fault code.

 

Declaration:

FUNCTION_BLOCK boardFaultLogGet;
VAR_OUTPUT
  count : INT;
  time : ARRAY[1..32] OF DINT;
  fault : ARRAY[1..32] OF SINT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  read : boardFaultLogGet;
  clock : clockLinsecToTime;
  str   : STRING;
  i     : INT;
END_VAR;
 
// Get list of faults
read();
// Iterate any faults
FOR i := 1 TO read.count DO
  clock(linsec := read.time[i]);
  DebugFmt(message := "fault= \1", v1 := INT(read.fault[i] AND 16#FF));
  str := strFormat(format := "\1.\2.\3", v1 := clock.day, v2 := clock.month, v3 := clock.year);
  DebugFmt(message := "time= \1:\2:\3, " + str, v1 := clock.hour, v2 := clock.minute, v3 := clock.second);
END_FOR;
 
BEGIN
  ...
END;
END_PROGRAM;