canLoggerLevel (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

MX2 pro, DX4 pro, CX1 pro-c/warp-c, MX2 turbo/encore/warp, NX-200, NX-400, LX2, LX5

Firmware version:

2.50 / 1.00.00


This function will return the amount of space used in the logger. The returned value is on a scale between 0 and 1000 (permille).

The exact size of the logger is specified during configuration (see canLoggerSetup).

Note: use canBufferLevel to check the level of use for the internal buffer.

 

 

Input:

port : SINT (1/2) (default 1)

The port of the logger.

 

 

Returns: INT

Amount of space used in the logger - 0..1000 permille.

 

 

Declaration:

FUNCTION canLoggerLevel : INT;

VAR_INPUT
  port : SINT := 1;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM CANExample;
VAR
  LogBuf : ARRAY [1..1300] OF SINT;
  level : INT;
END_VAR;
 
// Open can
canOpen(baud := 250);
canLoggerSetup(buffer := ADDR(LogBuf), size := SIZEOF(LogBuf));
...
 
BEGIN
  ...
  canLoggerStart();
  ...
  // List the number of received CAN messages
  level := canLoggerLevel();
  IF level >= 900 THEN
    // Logger level high mark, handle
     ...
  END_IF;
  ...
END;
END_PROGRAM;