Channel example - Simple mask

This example extends example Channel example - Single ID to demonstrate a simple use of the filter message ID mask (msgIDMask).

We want to create a filter which accepts two standard ID messages with specific message IDs (using only Channel 1)[1]:

  • ID 1: 200010=7D016=111110100002

  • ID 2: 200110=7D116=111110100012

Note

Note that the binary representation of the IDs are identical except for the rightmost bit.

To do so, we enable Channel 1 (channelEnb to true) and enable filtering (filteringEnb to true).

  • The filter msgID can be set to either of the two message IDs, we arbitrarily select 7D016

  • The filter msgIDMask is set to all ones except for the rightmost bit, 111111111102=7FE16[2]

Note

Setting the rightmost bit of the filter mask to zero effectively makes the filter ignore the value of rightmost bit.

To test if messages with both ID 7D016 and 7D116 pass the filter, we apply the filter mask to both the filter message ID (1 in below) and the message IDs (2 in below)[3]. As the results are equal, both message IDs are accepted by the filter.

Note

In below X is used to indicate either 0 or 1 as the value of the bit does not matter (due to the mask)

Filter IDFilter maskMasked filter111110100002&111111111102111110100002(1)Message IDFilter maskMasked ID1111101000X2&111111111102111110100002(2)

The resulting channel configuration becomes:

Compact overview of channel configurations

CHN[4]

channelEnb

extendedID

DSP[5]

filteringEnb

msgID

msgIDMask

1

true

false

1

true

7D0

7FE

2

false

false

1

false

00000000

1FFFFFFF

3

false

false

1

false

00000000

1FFFFFFF

4

false

false

1

false

00000000

1FFFFFFF

5

false

false

1

false

00000000

1FFFFFFF

6

false

false

1

false

00000000

1FFFFFFF

7

false

false

1

false

00000000

1FFFFFFF

8

false

false

1

false

00000000

1FFFFFFF