Main Content

Acceptance filter

R2026b

CAN identifier filter value

Model Configuration Pane: Hardware Implementation / Hardware board settings / Target hardware resources / Groups / CAN

Description

Specify the CAN identifier value used to filter incoming CAN messages. The CAN blocks compare the received message identifier with the specified value to determine whether the message is accepted. The acceptance filter works together with the Acceptance mask parameter to define the message filtering behavior. A message is accepted when: (Received ID AND Acceptance mask) = = (Acceptance filter AND Acceptance mask)

The acceptance mask determines which identifier bits are evaluated:

  • Bits set to 1 are compared

  • Bits set to 0 are ignored

When the Inverse filter parameter is enabled for a filter entry, the behavior is reversed, and matching messages are rejected instead of being accepted.

Dependencies

To enable this parameter, set Filter configuration (all interfaces) to Manually specify.

Settings

255 (default) | integer

Enter the acceptance filter as a decimal integer representing the CAN identifier to match.

255 (default)

Default filter value. When the acceptance mask is 0 (default), this value has no effect because no bits are checked.

Custom value

Specify the CAN identifier to accept. For standard (11-bit) IDs, valid values range from 0 to 2047. For extended (29-bit) IDs, valid values range from 0 to 536870911. The value must be specified in decimal. Use hex2dec() in MATLAB to convert from hexadecimal.

Examples

expand all

Set Acceptance mask to 0x7FF to evaluate all identifier bits.

Set the Acceptance filter to 100. In this configuration, the block accepts only messages with identifier 100.

With the default values set for Acceptance mask and Acceptance filter parameters, the CAN blocks do not evaluate any identifier bits and accepts all incoming messages.

You can configure acceptance filters for up to four filters.

Recommended Settings

ApplicationSetting
DebuggingNo recommendation
TraceabilityNo impact
EfficiencySet to target message ID
Safety precautionSet to target message ID

Programmatic Use

Parameter: CAN.AcceptanceFilter0 (filter 1), CAN.AcceptanceFilter1 (filter 2), CAN.AcceptanceFilter2 (filter 3), CAN.AcceptanceFilter3 (filter 4)
Type: character vector
Values: non-negative integer (as string)
Default: '255'

Version History

Introduced in R2019b