Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get my CAN message data seperated?

Ok, I am using the example filter given by NI to filter my CAN messages down to a certain arbitration ID.  There are several messages displayed still on this same ID.  I really need to get one message out of all of them.  I have seperated the data in to a for loop to try and narrow it down even more.  But the biggest issue is the fact that I need to get it down to one sigle array of data and still filter out the rest, so that I may compare this and find out if I have the right message.  Thanks

 

0 Kudos
Message 1 of 2
(6,240 Views)

Hello,

 

If you are using a standard ID, you can change the comparator and mask in to filter the messages based on the first 2 data bytes.  If you are using an extended ID, or the data is not in the first 2 bytes, you can loop through the array and unbundle each element to extract the data.  Once you have the data you can convert it into a boolean array and extract certain bits that can be then converted back into a number.  This number can be used as the selector for a case structure.  Create a case for any of the data you would like to process and use a Default case to ignore the rest.  

Caleb W

National Instruments

0 Kudos
Message 2 of 2
(6,223 Views)