Set specific CAN message acceptance filter configuration


filterSet(canch, code, mask, idtype)
filterSet(canch, id, idtype)

    Note:   You cannot set filters on an NI device channel.


filterSet(canch, code, mask, idtype) sets the CAN message acceptance filter to the specified code and mask. You also must specify the CAN identifier type idtype on the CAN channel canch.

filterSet(canch, id, idtype) sets the CAN message acceptance filter by determining the best possible code and mask based on the ID and identifier type specified in the input argument.

Input Arguments


The CAN channel that you want to set the filter for.


The value required for each bit position of the identifier.


The bits in the identifier that are relevant to the filter.


Set a filter on the CAN message with the id, range of ids, multiple ranges of ids, or a combination of ids.


A string specifying either a standard or an extended CAN message id type.


canch = canChannel('Vector','CANCaseXL 1',1)
filterSet(canch,500,750, 'Standard')

To let Vehicle Network Toolbox™ determine the best possible code and mask option:

 canch = canChannel('Kvaser', 'USBcan Professional 1', 1)
 filterSet(canch, [500:502 1000], 'Standard')
 filterSet(canch, [7500:8000 12000], 'Extended')

More About

expand all


  • You can configure message filtering only when the CAN channel is offline.

  • CAN message filters initialize to fully open.

  • Use filterReset to make the acceptance filters fully open.

  • filterSet supports either standard or extended CAN identifiers.

Was this topic helpful?