Coop wrote:
> I am reading hexadecimal format from the output of the VISA read block
> and I want to convert it to the decimal preferably exponential format.
> Example of what I read is 76 00 02 (in dec: 7.600 E+2).
> I know there is "type cast" block that converts nicelly but I am not
> sure what to specify for a type input.
> Can you show me how to apply this type cast block for in my VI so that
> it converts hex string (76 00 02) into exponential string/number
> (7.600 E+2)?
Looking at your code I see that you have not a hexadecimal string coming
back but instead a binary string. The fact that you display the string
as hexadecimal in the string indicator is just showing you the ASCII
codes of the string characters as hexadecimal numbers.
The funct
ion From Hexadecimal String expects a clear text string with
hexadecimal characters but that is something entirely different from a
binary string you choose to display as hexadecimal numbers.
An example: the binary string 7600 02 you receive from the device is in
fact the character 'v', a null character and a 02 character (or in ASCII
terms a start of text character).
So assuming your example is right (which I have to admit seems very
strange and therefore suspicious to me) you would have to do something
more like included example. But as I said I have little understanding
why the hexadecimal interpretation of the binary values should
correspond to the decimal value you want to have!
Also as you can see there is not really clear where the 00 character
belongs to. The two methods where it is either part of the multiplier or
the exponent both produce the same result for this particular example.
Which one is right if any, should be tested.
Rolf Kalbermatter