LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about the hex to decimal string conversion

Hello,
 
  I am having a hard time correctly using the hex string to number conversion. I am suspecting that I need to change the default base of the number to a unsigned int. Any ideas how I do that?
 
 
Regards,


Kaspar
0 Kudos
Message 1 of 6
(3,251 Views)

Hi Kaspar,

The Hexadecimal String to Number function should be used whenever you have a string that contains the actual ASCII characters that represent numbers, i.e. an ASCII string of "123" would be turned into the number 123.  What you're doing is a little different...your string actually contains characters represented as hex values (you have the string constant set to "Hex Display").  In order to get the VI to do what you need, you should use the Typecast function to cast the Hex string to a U8, then you can use the Number to Boolean Array function to turn that U8 into an array of Booleans...you may need to reverse that array depending on where you want the LSB in the array. 

Also, as a suggestion, in your VI you are using eight separate Index Array functions to pull out all the scalar Boolean values...you can actually use a single Index Array function, drag it down to have 8 'index' inputs, and by default it will output elements 0 through 7 in its resulting 8 outputs.

Hope this helps,
-D

Message 2 of 6
(3,238 Views)

Hello,

 

  Thanks for the info. I have found the type cast function and I am do not know how to specify the type input. How do I do that?

Regards,


Kaspar
0 Kudos
Message 3 of 6
(3,232 Views)

Just wire a U8 constant to it.  Drop a constant from the Numeric palette, right-click it and choose Representation, and change the representation from I32 to U8. 

Hope this helps,
-D

Message 4 of 6
(3,225 Views)
Here's a simple example (LabVIEW 8.0).
Message 5 of 6
(3,221 Views)

Hello,

 

  Thanks for the help with the decoder problem that I had! Smiley Happy  The people who are in this forum are GREAT!

Regards,


Kaspar
0 Kudos
Message 6 of 6
(3,208 Views)