LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hexadecimal to "readable" string

Hi,
I have written a program which opens a file, converts the contents of the file to hexadecimal and outputs the decimal values.  The program works great for giving me the decimal values, but the file also contains readable works like xsize, ysize.  All of the readable word lines begin with a comment character, #.  I have used the string-to-byte-array to generate the ASCII, but how do I take these values and translate them into works like # xisze, # ysize, ect?  The byte array gives me values like 38, 57, 58, 34, but looking at the ASCII table, these values are numebrs like 7,8,0.  Is there another conversion I have to do before I can get the corrsponding readable letter?
 
Adam
Message 1 of 18
(4,548 Views)
My guess is that you're displaying the byte value as a decimal, and assuming it's displayed in hex. Unless you change the format, a numeric indicator displays in decimal. For instance, an ASCII decimal value of 35 corresponds to "#". The hex value is 23.
Message 2 of 18
(4,539 Views)
Right now i have all the converted values displayed as both numeric array indicators and string indicators.  I am displaying the value as normal, when I display it as hex, I get values like 3030 3032 etc.  When I display it normal, I get values like 02000000.  How can I use the byte array values to convert them back into readable numbers?  I think I'm missing a really simple step, but I just can seem to figure it out.
 
Adam
Message 3 of 18
(4,534 Views)

I'm not sure I completely follow what you are looking for..

Are you trying to have a string that contains the HEX equivalent of the original string?

Let's see if I understood:  Say you have the word "Hello", it's ASCII equivalent in Hexadecimal is:  0x48 0x65 0x6C 0x6C 0x6F

And you would want a string that contains:  48 65 6C 6C 6F

If that is what you are looking for, please see attached VI.

Otherwise, please try again to explain what you need.

R



Message Edited by JoeLabView on 08-06-2008 08:43 PM
Download All
Message 4 of 18
(4,523 Views)
Yes thats a great of example of what I was looking for.  I understand everything except how to take the values 48 65 6C 6C 6F and convert them back into "Hello", so I can write it to a file.  I feel like its something little I can't seem to understand.
 
Adam
Message 5 of 18
(4,517 Views)
This VI function does it... with/without space between bytes
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 6 of 18
(4,511 Views)

Thank you so much, this is exactly what I was looking for.

Adam

Message 7 of 18
(4,505 Views)
***deleted message***

Message Edited by JoeLabView on 08-07-2008 08:41 AM
0 Kudos
Message 8 of 18
(4,485 Views)
I still don't understand what was being asked here, and I'm thinking that Ian's solution is more complicated than it needs to be if all you're dealing with is ASCII values to letter conversion.

Ian: You while loop can be replaced by a simple SpreadSheet String to Array function. Also, you should not lock VIs that you post to this forum. Any VIs that you post are public, and while a user can unlock it, it's considered bad form to post it that way. If you don't want somebody modifying your code, then you shouldn't post it.


Message Edited by smercurio_fc on 08-07-2008 08:59 AM
Message 9 of 18
(4,469 Views)

Thanks for posting Saverio,

I thought it was just me who didn't understand what the person was asking...  Had he/she been MORE clear, my example would have been more appropriate.  Heck, a simple change was all that was needed to achive the end solution.  As you said no loops involved...

Also, my belief is to provide a generic solution so that the person asking the question can have a clue how to solve the problem..  That way, they can learn instead of always relying on others.. 

shivels, to learn more about LabVIEW, I suggest you try looking at some of these tutorials.

R

Message 10 of 18
(4,450 Views)