LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hexadecimal string to number

Hi
 
        I am using LV7.1. When I am converting hex  string to number , I always get  0. What could be the reason?
 
Thanks
Madhu
0 Kudos
Message 1 of 11
(4,389 Views)
Hi!
   Post your code, possibly just the piece of conversion...

graziano
0 Kudos
Message 2 of 11
(4,379 Views)

Hi Madhu,

can you show us your vi or a picture of it? Maybe you use the offset output instead of value.

Mike



Message Edited by MikeS81 on 07-14-2008 01:19 PM
0 Kudos
Message 3 of 11
(4,377 Views)
...or maybe you leave the "0x" prefix Smiley Happy

graziano
0 Kudos
Message 4 of 11
(4,370 Views)
Hi
 
          here is my VI.
0 Kudos
Message 5 of 11
(4,331 Views)

Right click on the string control and switch the display mode from "Hexadecimal" to "Normal"

Worked for me, still a little confused why it would return 0 when "Hexadecimal" is selected.  Anyone?

LabVIEW 2012
0 Kudos
Message 6 of 11
(4,321 Views)
Hello Madhu,
 
turn the display mode to "Normal Display" and enter your hex code.
Hope this helps.
Uli


Message Edited by UliB on 07-15-2008 12:47 PM

Message Edited by UliB on 07-15-2008 12:48 PM
Download All
0 Kudos
Message 7 of 11
(4,320 Views)


craigc wrote:

Right click on the string control and switch the display mode from "Hexadecimal" to "Normal"

Worked for me, still a little confused why it would return 0 when "Hexadecimal" is selected.  Anyone?




In hex display, it will convert but the value has to be a valid ASCII hex character (0-9,A-F). For example, if in hex display, you entered 68, that is an ASCII G and the conversion will fail. Enter in hex display an F and this is the ASCII SI character which will fail. Enter a hex 44, this is an ASCII D and you get a value of 13 out.
0 Kudos
Message 8 of 11
(4,300 Views)

Thanks Dennis,

I thought it was ASCII however its still a little misleading.  Perhaps it really should be "ASCII hex codes" under the display properties 🙂

Craig



Message Edited by craigc on 07-15-2008 11:04 AM
LabVIEW 2012
0 Kudos
Message 9 of 11
(4,289 Views)
If you have your heart set on using the hex display mode for the control, you have to basically add up each hex byte. Here is a VI that will do that.
 
The title is only a little misleading, since a normal string is character-by-character representation of ASCII values, whereas the Hex string is a byte-by-byte representation of those values.
 
A normal string of FF would be seen as decimals 70 and 70.
A hex string of FF would be seen as decimal 255.
 
Since the Hexadecimal String to Number is expecting an array of 70 and 70, a single value of 255 will throw it off. 🙂
____
Ryan R.
R&D
0 Kudos
Message 10 of 11
(4,273 Views)