06-16-2014 07:22 AM
Hi, I am trying to analyze the readings from SRS RGA, and the output is in hex format (four byte integers, 2’s complement format, Least Significant Byte first).
Any help in converting this into a decimal number would be greatly appreciated.
Solved! Go to Solution.
06-16-2014 07:38 AM
So I assume you have a string with this data. Just use the Unflatten From String to convert the string to an I32. There in an input to that function to set the endian. You may have to set that to Little Endian.
06-16-2014 08:30 AM
Thanks for the reply.
I can see the binary string being converted into an 8 byte, little-endian (least significant byte first) integer value.
Since my output is in hex, I guess I will have to convert that into a binary string first, before I can convert into an integer.
How about the 2's complement part, don't I have to take care of that before I can do anything?
Thanks
06-16-2014 08:43 AM
So you are saying you have an 8 character string of hex characters, and that represents a 4-byte integer?
You don't need to worry about the 2-'s complement first. Get the 8 hex characters converted to 4 bytes first. Then use CrossRulz's example to convert those 4 bytes to an I32 integer.
06-16-2014 08:47 AM
Or is it an I64? I somehow skipped over the "8 byte" in my head before.
06-16-2014 08:48 AM
According to the user's manual of the SRS RGA, the output is in "hex format (four byte integers, 2’s complement format, Least Significant Byte first)."
06-16-2014 08:52 AM
To be exact, please see the quote from RGA Manual.
"Ion signals are represented as integers in units of 10-16 Amps, and transmitted directly in hex format (four byte
integers, 2’s complement format, Least Significant Byte first) for maximum data throughput."
06-16-2014 08:58 AM
Why does your subject line say "8 byte"? That is what is confusing things.
Atttach a link to the manual.
06-16-2014 09:05 AM
That's a type and sorry about that. It is 4 byte.
Here's a link to the manual
06-16-2014 09:12 AM