LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IEEE 11073 32bit float format

Solved!
Go to solution

How to convert 32bit hex number to IEEE 11073 32bit float format?

0 Kudos
Message 1 of 15
(9,742 Views)

@kiran.holla wrote:

How to convert 32bit hex number to IEEE 11073 32bit float format?


I think you mean IEEE 754.

 

Can you show us what you have tried thus far?

0 Kudos
Message 2 of 15
(9,717 Views)

Thanks tyk007,

 

No, I ment IEEE 11073 32bit float format.

I found the way, actually in IEEE 11073 ( 1st byte is Exponential (10 pow 1st byte) and rest 3 bytes are mantissa).

0 Kudos
Message 3 of 15
(9,698 Views)

Hi kiran,

 

please check for yourself: Wikipedia IEEE 11073

 

When you want to convert to a base10 32bit float you need to find a library which suports this conversion (use Google or any other search engine) - or use some bit-banging to program this conversion on your own…

 

When you already created a VI for this conversion: please attach it here for future reference!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 15
(9,678 Views)

@kiran.holla wrote:

I found the way, actually in IEEE 11073 ( 1st byte is Exponential (10 pow 1st byte) and rest 3 bytes are mantissa).


No sign bit?


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 15
(9,664 Views)

Thanks GerdW for the link.

 

I have attached what fitts to my solution. There could be number of way.

 

The attached VI requires Hex array passed, will give you Temperature in Celsius. I believe even signed value is taken care.

 

Note: 4 Byte Array(Hex) would be in BigEndien IEEE 11073 . i.e  value of 24.25 would be 79 09 00 FE

 

Let me know if there is any problem in it.

0 Kudos
Message 6 of 15
(9,613 Views)

Hi Kiran,

 

can you attach your VI for LV2014?

 

How are Base10 floats related to IEEE11073? Wikipedia doesn't mention them (when reading the article rather quickly)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 15
(9,589 Views)

Stackoverflow has a thread regarding the conversion of 11073 to a java float - 

 

http://stackoverflow.com/questions/11564270/how-to-convert-ieee-11073-16-bit-sfloat-to-simple-float-...

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 8 of 15
(9,574 Views)

Your code is not 100% correct. It works fine for positive numbers. BUT the mantissa is a 24bit signed integer. You are converting the mantissa string to a U32 integer and ignoring the sign bit in the string. This c-code came from the "STACKOVERFLOW" thread that PhillipBrooks mentioned. It is the conversion for a 12 bit integer. However, you can easily change the constants for a 24 bit conversion.

 

Mantissa Sign C-Code.PNG

0 Kudos
Message 9 of 15
(9,552 Views)
Solution
Accepted by topic author kiran.holla

Hi Kiran,

 

Let me know if there is any problem in it.

Well, I found a problem of using too much unneeded datatype conversions!

Is there a reason you need to convert U8 values to strings to be able to build other integer and DBL values from them?

 

Why not something simple like this:

check.png

The other case holds your version of this code…

(The shown code can be simplified even further, I just replaced your U8-to-string-to-U32 dance…)

 

Remark: both code version give the same result.

None give the result you expect according to your own statement:

Note: 4 Byte Array(Hex) would be in BigEndien IEEE 11073 . i.e  value of 24.25 would be 79 09 00 FE

So I guess there are other problems too in your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 15
(9,533 Views)