I see the acceptance code is Right side msb in the documentation
I want to filter on ID's in the 0x700 range
0x700 = 0111 0000 0000 left side msb
I've tried the following without luck....
acceptance_code = 0x700 << 21; // 0x38000000 = 0011 1000 0000 0000 0000 0000 0000 0000
acceptance_mask = 0b00000000111000000000000000000000; // 0x01800000
Any help? wanting id's in the 0x7xx range.
TWAI Acceptance code & mask
-
- Posts: 1706
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: TWAI Acceptance code & mask
Try
Note that the MSB of the code/mask value is matched against the first bit of the message (MSB of ID). With 11-bit IDs, the maximum ID is 0x7ff, so the MSB in the filter (0x80000...) corresponds to the 0x400 bit of the ID. And the mask bits indicate which bits of the code are used for filtering; a 1-bit in the code without the corresponding 1 in the mask does nothing and is a likely indicator of an unintended mismatch of mask and code.
Code: Select all
acceptance_code = 0xE0000000; // (0x700 << 21) = 0b1110000...
acceptance_mask = 0xE0000000; // same as code
Who is online
Users browsing this forum: No registered users and 130 guests