Jump to content

hex conversion


Recommended Posts

Hello all, I am using a sub VI that produces a byte array. I use "Byte Array to String" and display this value using a string indicator. I also want to take the 1-byte hex number and display its numeric value. For example, 0xFF would produce 255. I tried type casting and using "Hexadecimal String to Number" but it does not seem to be working. Any help would be appreciated.

Link to comment
Hello all, I am using a sub VI that produces a byte array.  I use "Byte Array to String" and display this value using a string indicator.  I also want to take the 1-byte hex number and display its numeric value.  For example, 0xFF would produce 255.  I tried type casting and using "Hexadecimal String to Number" but it does not seem to be working.  Any help would be appreciated.

4475[/snapback]

Well, display of a number in a miriad of formats is that, display only. The number itself does not change in memory at all. So what can you do?

1) Instead of displaying the byte array as a string array, configured to show hex format, you could directly display the byte array, click on the numeric in the array control and select "Visible Items->Radix" from the pop-up menu. Then click on the d that appears and select the numeric format you want to see. This will change how you see the number in the control but will do nothing to the numeric value itself.

2) Wire the byte array into a for loop with autoindexing enabled and use the apropriate To String formating function, either the Format into String with %d, or %x as formating specifier or one of the String Conversion functions such as Numbre To Decimal/Hexadecimal/Octal String.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.