boardFaultLogGetDebug (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

3.10 / 1.00.00


The boardFaultLogGetDebug is used to read the debug information of a fault log entry from the VPL application.

The function is designed to be used together with the boardFaultLogGet function block. Where boardFaultLogGet reads the fault log and boardFaultLogGetDebug reads the additional debug information if present.

 

The debug information returned in this function can also be read from the RTCU IDE.

 

Input:

index : INT;

The index of the fault entry to read.

 

Output:

filename : STRING;

The file name of the file where the fault occurred.

 

line : DINT;

The approximate line number in the file where the fault occurred.

 

threadid : INT

The ID of thread which executed the last know line of code.
This ID corresponds to the ID returned from thGetID().

 

Returns: BOOL

TRUE:

debug information present for entry

FALSE:

no debug infromation present for entry

 

Declaration:

FUNCTION boardFaultLogGetDebug;
VAR_INPUT
  index   : INT;
  filename : ACCESS STRING;

  line     : ACCESS DINT;
  id       : ACCESS INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  read : boardFaultLogGet;
  clock : clockLinsecToTime;
  str   : STRING;
  i     : INT;
  name  : STRING;
  line  : DINT;
  thread: 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);
  // Get the debug information from the fault log
  IF boardFaultLogGetDebug(index:=i,filename:=name,line:=line,threadid:=thread) THEN
    DebugFmt(message := "file= " + name);
    DebugFmt(message := "line= \4", v4 := line);
    DebugFmt(message := "thread= \1", v1 := thread);
  END_IF;
END_FOR;
 
BEGIN

  ...

END;
END_PROGRAM;