08-23-2016 11:18 AM
Hello!
So, At the moment, I'm trying to receieve data from a device that sends back data as an array of 10 bytes, where the first 2 bytes are a header, the next 6 are a word count that's suppose to be a single 48 bit value, and the last 2 are an error count which is suppose to be a single 16bit value.
Ex:
Word recieved
(---Header---) (----------------------------------Word Count------------------------------) (Error Count)
0 120 0 44 221 155 96 48 0 0
So, in theory, what I want to do is be able to calculate the values like this:
(---Header---) (----------------------------------Word Count------------------------------) (Error Count)
0 120 0 44 221 155 96 48 0 0
Binary Values: 00000000 00101100 11011101 10011011 01100000 00110000 00000000 00000000
Concat. Vals : 000000000010110011011101100110110110000000110000 0000000000000000
Calc'd Vals : = 192696508464 words = 0 Errors
* 40 (40 bit words)
Totals : = 7.7078603e+12 bits total = 0 Errors Total
But, the problem(s) I'm running into is that all the methods I'm using seem to not be correct.
I've tried:
Flattening the data and then unflattening it as a U64
Convering the data to bool arrays, concatinating it, then converting that to a number
Joining all the bytes together using the join function
Typecasting a byte array to a U64
And with every method, the data I get out is incorrect (In the sense that the values are incorrect compared to calculating it manually like I did above), and at this point I'm unsure how to go about getting the correct values, so any sort of help would be greatly appreciated!
Thanks!
Solved! Go to Solution.
08-23-2016 11:49 AM - edited 08-23-2016 11:54 AM
This seems to work for me...
08-23-2016 12:34 PM
I Don't know what part of it I was getting wrong before, but this worked perfectly! Thank you so much, I appreciate it!