canFlush (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:

1.40 / 1.00.00


This will remove all messages received from the CAN bus and currently stored in the internal receive buffer (see canReceiveMessage).

 

 

Input:

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

The port of the CAN bus.

 

 

Returns: INT

0

- The CAN bus is not open.

1

- Success.

 

Declaration:

FUNCTION canFlush : INT;

VAR_INPUT
  port : SINT := 1;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM CANExample;
 
// Open can
canOpen(baud := 250);
...
 
BEGIN
  ...
  ELSIF cmd = cmd_flush THEN
    // Clear received CAN messages
    canFlush();
  END_IF;
  ...
END;
 
END_PROGRAM;