canBufferLevel (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.20 / 1.00.00


This function will return the amount of messages currently stored in the internal receive buffer. The returned value is on a scale between 0 and 1000 (permille). The exact size of the receive buffer is specified in the help section for canReceiveMessage.

Note: use canLoggerLevel to get the level of the logger that is used.

 

 

Input:

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

The port of the CAN bus.

 

 

Returns: INT

Amount of messages that are used in the internal receive buffer - 0..1000 permille.

 

 

Declaration:

FUNCTION canBufferLevel : INT;

VAR_INPUT
  port : SINT := 1;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM CANExample;
 
// Open can
canOpen(baud := 250);
...
 
BEGIN
  ...
  // List the number of received CAN messages
  DebugFmt(message := "CAN buffer: \1 promille", v1 := canBufferLevel());
  ...
END;
 
END_PROGRAM;