Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Easiest way to convert a CAN frame that is in the form of an 8-byte array to a single 64-bit integer?

Solved!
Go to solution

I am writing a program that will test a manufactured unit. I figure the easiest way to run through really long automated test procedures is to compare bit patterns of entire frames. I have been trying to accomplish turning a read frame into a 64-bit integer for the last few hours and I just can't seem to get it to work. Does anyone have any ideas?

 

thanks,

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

Well, I came up with something that works but I feel like an easier way exists that I don't know about. I basically converted the 8 bytes into 64-bit integers, shifted them, and then added them together.CAN Frame Conversion.png

0 Kudos
Message 2 of 6
(2,688 Views)
Solution
Accepted by topic author Incrementum

Type cast?

ZYOng_0-1674964574172.png

 

-------------------------------------------------------
Control Lead | Intelline Inc
Message 3 of 6
(2,674 Views)

Yes, this was one of the first things that I tried. The problem is that it outputs a string. You can choose it to display as HEX, but when you try to compare a static value and the output it doesn't recognize that they are the same because of the different data types.

0 Kudos
Message 4 of 6
(2,645 Views)

OK, I'm a little slow. I apparently didn't know how to manipulate the Type Cast correctly.

 

Thank you for your solution.

0 Kudos
Message 5 of 6
(2,637 Views)

The Type Cast is the correct way to do this.  However I've seen performance is slightly better with joining of values.  I didn't test the performance with shifting.  When I do conversions like this I call an inlined subVI.

 

8 U8 Conversion to U64_BD.png

This is what is used in my Frame Signal conversion library.

Message 6 of 6
(2,572 Views)