LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert Ascii string containing hex info to hex string?

Solved!
Go to solution

Dear All,

 

I'm busy with making a control/read out program for ISCO pumps. 

 

At this moment I'm having troubles with sending the commands to the PUMPS in HEX. When I use a STRING CONTROL in HEX display everything works fine (when I manually write down the command in the string control). 

The command exist of a couple of parts: Destination/string length/command/Checksum. I'm trying to make an sub-vis which automatically calculates the checksum (modulo 256) and adds it to the string. Everything is going well: First I split the ascii command to bytes and I calculate the checksum and add the HEX value as an ASCII to the command string. Also a CR (=0D) is added. Now the whole string should be converted to hex. The string contains the right HEX nummers but they are in ASCII format. Here's were I experience the trouble, I'm not sure how to do it! 

 

So to summarize:

I have a ascii string containg the HEX values (for instance 315230303652454D4F544531420D) and it should be converted to a HEX string (For instance 3152 3030 3652 454D 4F54 4531 420D) so the ISCO pump will understand the command. 

 

The VI is attached.

 

Thank you in advance,

Bio

Message Edited by Biomass on 04-13-2009 03:44 PM
0 Kudos
Message 1 of 14
(6,641 Views)

Hi,
I only have Labview 8.5, but I think I understood your problem :
this is a begining of the solution (each block of 4 numbers is considered as the number to be converted as hexadecimal, and if you want to convert a block of 2 digits, the result will not be the same !)

 

Let me know if it helps you !
Best regards,
Vincent

Message Edité par ramses64 le 04-14-2009 08:37 AM
V-F
Message 2 of 14
(6,596 Views)
Solution
Accepted by Biomass

Bio,

 

This should do what you want.

Message 3 of 14
(6,576 Views)

Thank you guys! Wayne, yours is working really well! Ramses, I couldn't get your VI working, but thanks for the effort!

 

Solved!

0 Kudos
Message 4 of 14
(6,541 Views)

Solved!


Please mark which post you think is the best solution to your problem so that it will help others who are facing same problem and looking for a solution. I hope you know that you can mark a solution by clicking on "Options" located at the top right corner of the post (which you think is the best answer that solved your problem) and select "Mark as solution".

 

Thanks for your understanding,

Mathan

0 Kudos
Message 5 of 14
(6,519 Views)

I'm having the same problem using LabView 7.1 for the solution can I get picture of that solution

 

thanks

0 Kudos
Message 6 of 14
(5,878 Views)

ullo,

 

Here is image.

Message Edited by Wayne.C on 10-16-2009 08:43 AM
Message 7 of 14
(5,860 Views)

Hello everybody,

 

I have quite the same problem, I have a string of Hex I would like to transform into a hex string.. I would like to understand the VI of Ramses because It seems a little bit difficult. My initial string BF61E687 must become the hex string BF61 E687 that I transform into SGL to have -0,882424.. Someone can help me?

 

Thanks you very much

 Kastillio

0 Kudos
Message 8 of 14
(5,783 Views)

Hi kastillio,

 

you can do it like this:

hex2SGL.png

 

No need to get a string suitable for hex display... The last function is a typecast - be sure to wire a SGL constant to the type input!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 14
(5,761 Views)
Thank you very much, it works! It was quite simple, I still have to discover Labview.. 😉
0 Kudos
Message 10 of 14
(5,748 Views)