canFilterDestroy (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.00 / 1.00.00


canFilterDestroy will destroy a receive filter that is no longer needed. The filter ID retrieved from canFilterCreate, canFilterCreateOnce. or canFilterCreateX must be used to identify the filter.

 

 

Input:

filterid : SINT

ID for the filter to destroy.

 

 

Returns: SINT

0

- Success.

1

- Illegal filter ID.

 

Declaration:

FUNCTION canFilterDestroy : SINT;
VAR_INPUT
  filterid : SINT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  canRX : canReceiveMessage;
  buf   : ARRAY [1..8] OF SINT;
END_VAR;
 
PROGRAM CANExample;
VAR
  Filter_ID : SINT;
  cmd       : SINT;
END_VAR;
 
// Open can
canOpen(baud := 250);
canRX(data := ADDR(buf));
 
BEGIN
  ...
  IF cmd = 16#02 THEN
    // startID: Priority=3 Reserved=1 Data page=0 PGN=00FDD6
     Filter_ID := canFilterCreate(xtd:=TRUE,startID:=16#0EFDD600,length:=6);
  ELSIF cmd = 16#03 THEN
    canFilterDestroy(filterid:=Filter_ID);
  END_IF;
  ...
END;
 
END_PROGRAM;