LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert hex to unsigned integer

Here's the program that I'm working with: basically converting hexadecimal strings into signed and unsigned numbers.
 
Right now, I'm having trouble converting a 2byte hex number to a decimal format.  Although all my 4byte hex number conversions are working.  Does anyone have a solution to this problem.
0 Kudos
Message 1 of 6
(7,001 Views)
One way to do this is using typecast. Example attached.
 
David
0 Kudos
Message 2 of 6
(6,986 Views)
Attached are some other manipulations with hex formatted strings
 
 
-James
 
 
 

Message Edited by James R on 11-30-2006 06:38 PM

- James

Using LV 2012 on Windows 7 64 bit
Download All
0 Kudos
Message 3 of 6
(6,978 Views)
Alright, I actuallly see what I was doing wrong now.  Should have been using the U16 instead of the U32 for the 2byte hex conversion.  I actually just converted my Hex strings, to binary numbers, then did my computations from there.  Thanks for the help.
0 Kudos
Message 4 of 6
(6,948 Views)
Hi,
I'm trying to do the same thing but I'm using Labview 7.1. Could you possibly save the vi in 7.1 format? I would really appreciate it.
Thanks,
Teri
0 Kudos
Message 5 of 6
(6,863 Views)

--------------------------------------------------------------------------------
task wrote:
I'm trying to do the same thing but I'm using Labview 7.1.
--------------------------------------------------------------------------------

You added to a thread that is six weeks old, and since you could not see the original VI (it's in LabVIEW 8.0) we're not sure if you are really talking about the "same thing". 😉
 
Let me explain. There is no such thing as a "hexadecimal string" per se. 😉 We have two possible interpretations:
  1. An interger formatted as hexadecimal string consisting of a series of ASCII characters 0-F. (e.g. 2 characters per U8, 4 characters for U16, etc.)
  2. A general binary string (with its display possibly set to hexadecimal), where the bit pattern directly represent an integer. (1 byte for U8, 2 bytes for U16, etc.)


In any case, for case (1) you would use for example  "scan from string" (with an %x style format code) or "hexadecimal string to number". For case (2) you would use "typecast" or "unflatten froms tring". Check the help for these functions and it should be clear what you need. Let me know how far you get.

If you continue to have problems, please attach a small example containing some typical input strings as default data.

Message 6 of 6
(6,839 Views)