CAN adress bit masking
Posted: Sat Aug 01, 2020 1:36 am
Hi,
I am setting up some extra sensors over a CAN bus unit. These come with dedicated CAN adresses. Some of them are not 8 or 16 bit though, so not using a full byte. So I use the BIT mask function.
Now, when I have a 12bit channel that is transmitted on e.g. BYTE0 and BYTE1 (full byte 0, half of byte1) , then I use offset 0, length 2, and mask FFF0 but that doesn't work.
For the following 12bit channel (so using second half of BYTE1 and all of BYTE2) I use offset 1, length 2 and mask 0FFF and that works perfectly.
Any suggestions on what I might be doing wrong there?
I am setting up some extra sensors over a CAN bus unit. These come with dedicated CAN adresses. Some of them are not 8 or 16 bit though, so not using a full byte. So I use the BIT mask function.
Now, when I have a 12bit channel that is transmitted on e.g. BYTE0 and BYTE1 (full byte 0, half of byte1) , then I use offset 0, length 2, and mask FFF0 but that doesn't work.
For the following 12bit channel (so using second half of BYTE1 and all of BYTE2) I use offset 1, length 2 and mask 0FFF and that works perfectly.
Any suggestions on what I might be doing wrong there?