CAN adress bit masking

D153, D175, C125, C127, C185 and C187 forum

CAN adress bit masking

Postby steven.casaer on 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?
steven.casaer
 
Posts: 3
Joined: Sat May 02, 2020 6:35 pm

Re: CAN adress bit masking

Postby David Ferguson on Sat Aug 01, 2020 3:54 am

What does "doesn't work" mean? What exactly is being sent (show us the bytes of the CAN packet), and what value is being received? What are the Multiplier / Divisor and Adder values?

Here is my guess: Did you divide by 16 to shift the data into the correct bit position?
David Ferguson
Veracity Racing Data
David Ferguson
Pro User
 
Posts: 1379
Joined: Fri Nov 07, 2008 2:45 am
Location: Paso Robles, California

Re: CAN adress bit masking

Postby steven.casaer on Sat Aug 01, 2020 7:31 pm

good guess.

found that as well last night in a 2016 post here

viewtopic.php?f=70&t=3455

now all good. Thanks
steven.casaer
 
Posts: 3
Joined: Sat May 02, 2020 6:35 pm


Return to Colour displays

Who is online

Users browsing this forum: No registered users and 15 guests

cron