LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Who know how to convert float number to hexadecimal string ?

Hi all ,
Who know how to convert float number to hexadecimal string ?
For example ,500.11 convert 43FA0DF0 .
0 Kudos
Message 1 of 23
(11,565 Views)
Presumably you're referring to IEEE spec 754 which discusses how to convert floats to hex values? If so, here's an example that uses SGL (you can just add the string function to get a hex string from the U32):


Note: that's an array of U32 constants.

Message Edited by smercurio_fc on 04-25-2007 11:20 AM

Message 2 of 23
(11,557 Views)
 

"Presumably you're referring to IEEE spec 754 which discusses how to convert floats to hex values? If so, here's an example that uses SGL (you can just add the string function to get a hex string from the U32):

 "
 

Thank you in advance

Yes , but according to your meaning ,I still can't get  43FA0DF0 from 500.11

.

Could you help me once again or give a sample  ?

0 Kudos
Message 3 of 23
(11,532 Views)
That's because it's supposed to be "43FA0E14". At least according to one online calculator.

How did you calculate "43FA0DF0"?

Message Edited by smercurio_fc on 04-25-2007 12:22 PM

Message 4 of 23
(11,529 Views)
Yes ,you are right .
but can it is converted by LabView ?
Thanks.
Message 5 of 23
(11,524 Views)
I don't understand what you're asking. The above code I showed you does a conversion from SGL to a U32 using IEEE754 in LabVIEW. All you need to get a string is to add the "Number to Hexadecimal String" function. See attached VI (LabVIEW 8.2).
Message 6 of 23
(11,520 Views)

Thank you very much !

You are a great man !

Message 7 of 23
(11,513 Views)
And if you want to save some diagram space, you don't even need the detour via an U32 array. Just cast to a scalar directly. 🙂

Same difference! 😮

Message Edited by altenbach on 05-08-2007 08:48 AM

Download All
Message 8 of 23
(11,363 Views)
Quite true. Smiley Very Happy

I can't quite remember why I had an array there to begin with. That code is from an earlier project I had worked on. There was a reason for it, but I can't remember what it was. Whatever it was, it only mattered for that project.
Message 9 of 23
(11,353 Views)
Another way to make this conversion is to use flatten to string.

BTW, 43FA0DF0 is actually about 500.109, which probibly got rounded to 500.11 for display.

Mike....

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 10 of 23
(11,336 Views)