LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convers ascii string to hex string

I need to send a hex string such as 5051525354A5A6A7A8A9 to a DSP across a serial port.  The string is read in from a file.
When I send this string to the DSP, it does not recognize the correct hex values.
If I enter the hex value, 5051525354A5A6A7A8A9, in to a string control that is set to hex display and then change the control to normal display, I get PQRST¥¦§¨©.  When I send this string,  PQRST¥¦§¨©, to the DSP, it recognizes the correct hex values. 
How can I change the hex string read from the text file to this type of ASCII character conversion?  I've used type cast and the other functions available in LabVIEW with no success.
This is only one of many strings I need to send so I don't want to hard code PQRST¥¦§¨© or some such string for each message.
0 Kudos
Message 1 of 25
(28,209 Views)
Examples are available in this post. I used "ascii hex" as my user search and found many other examples as well...

http://forums.ni.com/ni/board/message?board.id=170&message.id=226678&query.id=453213#M226678

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 25
(28,189 Views)
Thanks, that did it.
0 Kudos
Message 3 of 25
(28,181 Views)
Here's a slightly simpler way.
 

Message Edited by altenbach on 08-23-2007 12:17 PM

Download All
Message 4 of 25
(28,179 Views)

hi,

im using this .vi to convert the hexadecimal string. the weird thing is my friend also used the same vi but he get different answer and the answer is what we suppose to get. the number i used is 60025205000006002D42012844022346. my result as below.

Captureq.PNG

 

0 Kudos
Message 5 of 25
(22,797 Views)

It is not clear what you mean.

 

What's wrong with the result shown? What result do you actually want?

0 Kudos
Message 6 of 25
(22,794 Views)

suppose i get below answer when the barcode being scan.

"r%  & Mb!Hd"Cf

0 Kudos
Message 7 of 25
(22,789 Views)

and im using labview 12.0. is it because of the version?

0 Kudos
Message 8 of 25
(22,778 Views)

@ikaloopy wrote:

suppose i get below answer when the barcode being scan.

"r%  & Mb!Hd"Cf


Suppose what?  Can you give a more complete description as to what is right and what is wrong? 

 

For the string you posted above, the hex characters would be.

2272 2520 2026 204D 6221 4864 2243 66

 

That doesn't look anything like the string of hex characters you posted in the earlier message.

 

And I'm sure that it has absolutely nothing to do with what version of LabVIEW you are using.

0 Kudos
Message 9 of 25
(22,772 Views)

Thanks RavensFan,

the value u posted are the one im searching for.

right now im like assemble the puzzle pieces.no direct infor.can u show me how u convert from the value i gave to the one u posted above?

0 Kudos
Message 10 of 25
(22,768 Views)