‎07-13-2009 11:17 AM
Solved! Go to Solution.
‎07-13-2009 11:41 AM
‎07-13-2009 12:39 PM
Hi VADave,
What do I put for the 'type' input?
‎07-13-2009 02:49 PM
‎07-13-2009 02:54 PM
@Ravens Fan, he wants to convert backwards. So he have to connect to the Type Input a Byte Array and not the Single Float.
Other thing is if the output shold be in the Big or Little Endian Format. If also little endian,than you have to take the Flatten To String VI.
‎07-13-2009 03:05 PM
Eugen Graf wrote:Ravens Fan, he wants to convert backwards. So he have to connect to the Type Input a Byte Array and not the Single Float.
Other thing is if the output shold be in the Big or Little Endian Format. If also little endian,than you have to take the Flatten To String VI.
You sure about that? He doesn't exactly say where his came from. But since he says he has goofy looking characters, that sounds like it's ASCII, thus a string indicator. And he says he wants a number.
So it seems like he wants to convert a string to a number.
Your point about endianness is a good one to meake.
‎07-13-2009 03:18 PM
‎07-13-2009 03:23 PM - edited ‎07-13-2009 03:25 PM
Ok, I was wrong.
So you have not a Float on Input, you have a binary string. You want also represent this binary string as a float. So use either the Type Cast or Unflatten From String VIs.
After you got a Float value from your binary string you can convert them to a number without commata and you can change the representation of this to DEC, HEX, OCT or BIN.
P.S. I think your problem is that you don't understand the difference what binary and what ASCII strings mean.
‎07-13-2009 03:35 PM
ksin wrote:
The input is supposingly a 32-bit float and it is a string in the Labview code. I want to convert it to either a hex or dec value
First you need to typecast to SGL as already suggested. This will give you a numeric.
(Hex vs dec makes little sense. That's just a cosmetic formatting operation and does not change the underlying data. Does your SGL number contain fractional parts or are they all whole numbers?)
If you want the original 4 bytes as a hex formatted string with 8 characters (similar to what you would see when changing the original string to hex display), you would cast it to a U32 instead and format it with %08x, for example.
‎07-14-2009 09:25 AM
Thanks for all your suggestions. The only thing I know for sure is that the device's (a temperature controller) output is an IEEE 754 32-bit float data type as mentioned in it's spec. The VI that I'm using was provided by the company but they do not provide support for the code. So I'm actually left guessing what the data format is coming out of the VISA read module. After a whole day and you guys' help, it's probably a binary string. String I know for sure cus it's pink!
Just in case you're wondering, I do not have much experience dealing with data manupilation and Labview itself. Thanks for your paitence.