LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Raw Hexadecimal to Floating Point Conversion for RPM readings from an Inverter

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!

0 Kudos
Message 1 of 10
(2,992 Views)

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?

0 Kudos
Message 2 of 10
(2,963 Views)

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.

0 Kudos
Message 3 of 10
(2,942 Views)

@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.

0 Kudos
Message 4 of 10
(2,932 Views)

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?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 10
(2,876 Views)

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

0 Kudos
Message 6 of 10
(2,870 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 10
(2,869 Views)

@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.

Message 8 of 10
(2,838 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 10
(2,828 Views)

there was no way I could have done without you two. thanks!

0 Kudos
Message 10 of 10
(2,731 Views)