Quantcast

Documentation Center

  • Trial Software
  • Product Updates

filterSet

Set specific CAN message acceptance filter configuration

Syntax

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

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

Description

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

canch

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

code

The value required for each bit position of the identifier.

mask

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

id

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

idtype

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

Examples

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

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

Tips

  • 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.

See Also

| |

Was this topic helpful?