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.

Here's a slightly simpler way.
Message Edited by altenbach on 08-23-2007 12:17 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
HexStringtoBinaryString.png ‏10 KB
HexStringtoBinaryString.vi ‏11 KB

Similar Messages

  • BIG ASCII string to HEX string

    Hello guys,
    I know that is already a lot of posts regarding this issue, but I couldn't find exactly what I need and also couldn't manage to solve it myself...
    I need to convert a string with ASCII characters to a string containing HEX representation of these characters.
    What I did was: 
    Apparently it works very well, but only for a limited numbers of characters, defined by data representation of the 0 constant (U64). It allows me to convert only 8 ASCII characters, as you can see on the image below:
    So, it converted from 0 to 7, but not the remaining characters (8 and 9).
    Any ideas??
    Thanks in advance!
     

    What is the data type of the constant wired into the typecast.  My guess is it is a U64.  So it will only typecast the first 8 bytes of your string to a number, then you are doing hex on those 8 numbers.
    Use the function String to Byte Array.  Or you could also typecast where an array of U8 integers is wired into the typecast function.

  • How to convert noraml string to hexa string in teststand

    Hi,
    I need to send RS232 command in hexa format (type - string), but in teststand it is taking as ASCII characters.
    Tried in Labview, working fine, but in teststand i m facing difficult.
    Please help !
    Thank you

    Here you are,
    Locals.strHex = Str(Locals.u64_Val,"%x")
    Regards
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=
    Attachments:
    ToHex.seq ‏5 KB

  • Non ASCII String to Hex

    Hi,
    I am writing an algorithm that first encrypts a String, and then converts that String to Hex String. I can successfully parse Hex Strings into Ascii Strings and vice versa, but when I encrypt I cannot do this anymore. Is there a way to convert a non-ascii character to Hexadecimal and vice versa?
    Thanks in advance

    Maybe so....
    The encrypted value when printed does not format on my screen, and appears as boxes and such.
    The values that I am passing in are a very simple encryption....XOR against a key. Here is that algorithm.
    public byte[] encrypt(byte[] value) {
              byte[] encrypted = new byte[value.length];
              byte[] adjustedKey = getKey();
              while (adjustedKey.length < encrypted.length) {
                   String temp = new String(adjustedKey) + new String(key);
                   adjustedKey = temp.getBytes();
              for (int i = 0; i < value.length; i++) {
                   encrypted[i] = (byte)(adjustedKey[i] ^ value);
              return encrypted;          
    Since this is an XOR, I can use the same method to decrypt as well. This is what produces my non-Ascii characters.
    Is there a way for me to get the byte value of a 1 digit hex value then? this may help some.

  • Hex string upload as blob data to sql server

    It need to open a file and read the content and upload to sql server(2005) as blob data.
    But it seems give error as the attached screen.
    So I tried to convert the file content string to hex string, but it take quite long time.
    Is there any way to shorten the time or any other ways.
    Any suggestion, thanks.
    Attachments:
    ss.png ‏73 KB

    Try this.

  • Hex String to 'Ascii Hex' String!

    I am having a mental block and wonder if someone can help!!
    I am reading a serial device and getting a hex string back. I need to display this hex string to the operator within a pop-up box (PDA). The Message box will obviously contain normal text with the HEX code appended to the bottom.
    When I run the code the pop-up box displays the legible message to the user but the HEX string returned appears in the appropriatte ascii characters (because the pop-up displays normal string).
    My question is, how to make an hex string appear within a normal display string indicator 'the same' as it appears in its Hex display indicator:
    0x0A1C - Hex display needs to appear as 0A1C in normal display string indicator.
    Thanks in advance
    ssk
    Solved!
    Go to Solution.

    See picture.
    Message Edited by andre.buurman@carya on 04-08-2009 12:41 PM
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)
    Attachments:
    Hex string to normal string.png ‏4 KB

  • Hex string conversion to ASCII Character string

    I have a Hex String 494A4B4C and want this string to get converted in ASCII Character String. IJKL. How to do in Labview 8.5.

    Here is a screenshot of the described code:
    Ton
    Message Edited by TCPlomp on 30-09-2009 01:35 PM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Example_VI_BD.png ‏3 KB

  • Concatenate hex string with ASCII string

    Hello,
    I'm new to LabView and I'm building an application that speaks to a camera. I'm stuck at something that seems quite basic: I need to concatenate a constant string of hex values (0002 040D ...) with an ASCII string of hex characters (00D0A10F, for example), that comes out of a "Number to Hex string" block. The output should be a string of hex values (0002 040D 00D0A10F) and go to the camera, but the concatenate block turns the ASCII string into hex display too, so that every character is converted to two hex symbols....
    I found a very old post where someone claims they found a solution; unfortunately, it's not posted...
    Does someone have an idea what do to do?
    Thanks a lot!
    Michal
    Solved!
    Go to Solution.

    Hi,
    Give this a try - it converts an ASCII string of hex characters into the ascii characters.
    So, if you view the output as hex, it should concatenate properly with your other data.
    Dan
    Dan
    CLD
    Attachments:
    hex to ascii.vi ‏8 KB

  • Conversion from hex string to bytes withh out ascii

    how to convert hex string to byte numbers without ascii codes,then all the converted bytes should come into a packets

    rajkumar5 wrote:
    how to convert hex string to byte numbers without ascii codes,then all the converted bytes should come into a packets
    What people consider ASCII and Hex with strings varies so much, you pretty much need to supply an example.  The best way is to create a VI with default data in the string control and indicator (to show what you want out).

  • How can I write this string to a file as the ASCII representation in Hex format?

    I need to convert a number ( say 16000 ) to Hex string ( say 803E = 16,000) and send it using Visa Serial with the string control in Hex Mode. I have no problem with the conversion (see attached). My full command in the hex display must read AA00 2380 3E...
    I can easily get the string together when in Normal mode to read AA0023803E... but how can I get this to hex mode without converting? (i.e. 4141 3030 3233 3830 3345 3030 3030 3031 )
    Attachments:
    volt to HEX.vi ‏32 KB

    Sorry, The little endian option was probably introduced in 8.0 (?).
    In this special case it's simple, just reverse the string before concatenating with the rest.
    It should be in the string palette, probably under "additional string functions".
    (note that this only works in this special case flattening a single number as we do here. If the stat structure is more complex (array, cluster, etc.) you would need to do a bit more work.
    Actually, you might just use typecast as follows. Same difference.
    I only used the flatten operation because of the little endian option in my version.
    Message Edited by altenbach on 11-16-2007 11:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    littleendian71.png ‏4 KB
    littleEndiancast71.png ‏4 KB

  • How could I choose some bytes from HEX string and then convert it to a decimal value?

    Hi I am working with an OMRON E5EN temperature controller using VISA serial to get data, I send the Read from Variable Area command and get this string  in hexa 0230 3130 3030 3030 3130 3130 3030 3030 3030 3030 3041 3203 71 or .01000001010000000000A2.q in ASCII this string means:
    02 STX
    3031 3030 Node and subadress
    3030 End Code Normal Completion
    3031 3031 Command Read from Variable Area
    3030 3030 respt code Normal completion
    3030 3030 3030 4132 Hexadecimal A2 = 162  (this is the temperature data that I want to show in decimal)
    03 ETX
    71 Block Check Character
    I want to choose the eight bytes for the temperature data and convert it to a decimal number. I have seen the examples to convert a Hexa string to decimal but I do not know how to choose the specifics bytes that I need.
    I have look for a driver but i didn´t find any. I am a beginner so please include especific topics for me to study in your answer.
    Thanks
    Carlos Fuentes Silva Queretaro Mexico 

    If the response always has the temperature starting with byte 15 and is always 8 bytes in length, you can use the String Subset function to get those bytes out of the string.  Then use Hex String to Number to convert to a decimal number.
    Well someone already beat me to the solution:
    Message Edited by tbob on 01-04-2008 04:42 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    HexStr2Decimal.png ‏7 KB

  • Non-hex character in hex string after upgrade to Yosemite

    Hi,
    When I try to open some of my files I get an error: "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string". I could open the files before.
    The only thing I've done since I opened the file last was to upgrade to Yosemite. The error occurs on both my Mac Pro (late 2013) and Mac Book Pro with Yosemite. Unfortunately, I have no access to a Mac with Mavericks and CS6 but I will try to fix one to verify that the file works there.
    Affected files  (Created in Illustrator CS6 on Mavericks):
    services.ai
    visual guidelines v.0.4.pdf
    visual guidelines.ai
    Tested steps:
    Open previous versions of the same file from our repository
    Update Illustrator CS6 to latest version
    Download Illustrator CC
    Tried to Place the file into another file (same error)
    Tried to repair file Enable content recovery mode | Illustrator CS2-CS5

    Hi svepdesigncenter,
    How you are accessing those files from your repository?
    There might be chances of getting files corrupted when transferring.
    File may have been sent as ascii when it should have been sent as binary or vice versa.
    In 99% of transfers it's ALWAYS safest to zip an AI or eps file before sending it anywhere.
    Regards,
    Sumit Singh

  • I want to communicate a RS485/2-wire device through COM1. I tried Instrument I/O Assistance to write to COM1(hex string with or without end bye:0D0A), something happened on the bus, but is not defirrential signal, and device didn't recognised them.

    I am new to LabView, so please bear with me...
    I tried to communicate with an RS485/2-wire device through COM1.  I used Instrument I/O Assistant (and Advanced/Basic Serial Write and Read examples) to write command (HEX string) to COM1,  
    tried writing HEX strings with and withour end bye (is 0D0A the correct end signal for HEX string?).  Both didn't get device's responce.  Looks like the device didn't recognize the command.
    I monitored the transmitted signals on the bus, they were not differential as supposed to be.....
    What is the possible reason to cause this? Please help...
    The hardware connection is OK, because I am able to communicate with the device through COM1 (with the same command) using different software application.

    How are you sending the hex? Is your string control set for hex display or normal? If it's set for normal, then if you send something like 'AD', then you aer sending the ASCII characters 'A' and 'D' and that's not the same thing. I don't believe the I/O assistant can send hex but you can modify the basic serial write and read to do so. Just right click on the string control and select 'Hex Display'. You can also enter the data in a numeric control (set for dex display) and use a type cast or an array of U8's and use the Byte Array to String function. Hex data usually doesn't use any kind of termination characters such as CR/LF.
    If communication is working with another app, then as you said, the hardware is okay and it's not a problem with differential signaling.

  • Is the data sent to COM Hex string?

    First.I don't know who should change the data to ASCII,me or COM ?
    Second,I want to know if the data sent to COM is only Hex string?

    In Labview, the data sent to the com port is usually a string that is sent to the com port as the hex equivalent. If you want to send hex, use the \ codes for stings while displaying the string in slash codes format. The only thing being sent to the com port is hex.
    The data received on the com port is usually hex that is interpreted into ascii by LabVIEW. Sometimes the sender of the com data formats the information in another way. The programmer will have to convert data (which looks like gibberish in a string) into the proper format.
    Jeremy Braden
    National Instruments

  • Hex Strings

    How do you convert a string such as 004055000009
    in to a hex string like 00 40 55 00 00 09 and
    then add 1 to it so it becomes 00 40 55 00 00 0A
    then output it as a normal string like
    00405500000A.
    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.

    If you read the API for that method, you'll see, "The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign."
    Try either parseInt that takes a radix or java.text.NumberFormat.

Maybe you are looking for

  • Opening a .doc file in Pages results in Untitled document?

    Hi all! I've reinstalled iWork '06, along with the rest of my OS, and I've noticed something strange: if I set Pages as default to open .doc files, every time I double-click on a .doc file, Pages opens it in an Untitled document. Of course, when it c

  • IDvd won't display thumbnails of slideshow photos

    Hi, I'm having trouble with my iDvd. All works fine, music, themes, and the like, but when I want to make a slideshow, with selected photos, idvd does not display the photos in the thumbnail view. All it does is try to load it. I've waited and waited

  • Getting out of edge

    Hello, I just joined the edge program last week. Now after further research, I don't think I want to be a part of it. Is there anyway I can get out of it? Thanks for your response !

  • HT1338 how can i update java se 6 runtime

    when i update my mac to os x 8, my some softwares didn't work. they asked java se 6 runtime. but, i can't download from their link. what should i do.??

  • Download assistant isn't showing me any products to download. Any advice?

    I have download the Adobe Download Assistant, and it installed successfully. When I open it, in the bottom left where it says "All Products", "Show me: select products", the drop down menu won't open. The screen under "Products you may like" is also