11-04-2019 11:49 AM - edited 11-04-2019 12:02 PM
I am receiving my values in the following format "0203 045F FFBC EA1A 58" where I pull out the data part which is "5F FF BC EA" this is the RPM value of the inverter when it is not rotating, it is oscillating between " 00 00 00 00", I would like to learn how to interpret it as positive and negative floating point number.
Thanks in Advance!
11-04-2019 12:18 PM
Be careful with the word "format", because you have a binary string in hex display. (Not a formatted string with characters 0..F, space delimiters, etc)
What RPM value do you expect from the given string? Do you know the byte order?
As a first step we might try typecasting to SGL. (array reversed or plain). Is there any scaling involved?
11-04-2019 01:08 PM
It should be around -0.03 rpm( I am at home but it should be around this value), LeastSignificantBit to MostSignificantBit(LSB-to-MSB is the bit order in a byte) and no scaling. Eventually while doing the tests that I want to do it will be rotating to one direction only.
11-04-2019 01:38 PM
@ardahatunoglu wrote:
LeastSignificantBit to MostSignificantBit(LSB-to-MSB is the bit order in a byte.
"Bit order" in a byte is not a thing. Byte order defines the order of bytes in multi-byte data.
11-05-2019 07:27 AM
Just playing around with the data, it is definitely not a raw SGL. So what does the documentation say on how to interpret the data?
11-05-2019 07:37 AM
Thanks for helping out by the way I learned a lot already which I didn't have almost any idea about endianness. I am using MODBUS RTU which generally implements IEEE 754 standard. Big Endian should be the format. So the hex that I wrote "5FFFBCEA" coressponds to 3.6855722E19 which indicates there is a problem
11-05-2019 07:37 AM - edited 11-05-2019 07:38 AM
@ardahatunoglu wrote:
It should be around -0.03 rpm( I am at home but it should be around this value), LeastSignificantBit to MostSignificantBit(LSB-to-MSB is the bit order in a byte) and no scaling.
There has to be scaling of some sort. Again, playing around, I came up with this setup. Double check to documentation and correct as necessary.
11-05-2019 02:40 PM - edited 11-05-2019 02:41 PM
@ardahatunoglu wrote:
I am receiving my values in the following format "0203 045F FFBC EA1A 58" where I pull out the data part which is "5F FF BC EA" this is the RPM value of the inverter when it is not rotating, it is oscillating between " 00 00 00 00", I would like to learn how to interpret it as positive and negative floating point number.
Thanks in Advance!
If I take the raw data "5F FF BC EA" and swap the order of the words to "BCEA5FFF" and feed that into the IEEE-754 converter here, I get a decimal value of -2.8610228e-2, or about -0.0286, which sounds like the -0.03 you're expecting to see.
11-05-2019 02:52 PM - edited 11-05-2019 02:52 PM
@AaronTeitlebaum wrote:
If I take the raw data "5F FF BC EA" and swap the order of the words to "BCEA5FFF" and feed that into the IEEE-754 converter here, I get a decimal value of -2.8610228e-2, or about -0.0286, which sounds like the -0.03 you're expecting to see.
Yep, that seems a lot more likely than what I posted earlier.
11-12-2019 09:53 AM
there was no way I could have done without you two. thanks!