LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert string input from teststand to hex in labview

Hi,

 

I am using TestStand to develop my automated test by calling the labview modules that I have created. Now I am wondering if I pass a string containing hex values to the labview module, how can I convert that into the hex string to be sent to my device?

 

For example:

In TestStand I create a string variable with value of "00A9 8AC7 0153 158E" and this will be fed to one of the inputs for a labview module. This module will concatenate this hex values with other pre-defined values and bundle as a command to be sent through serial to my device. How can I convert the values received from TestStand into hex representation? Meaning from "00A9 8AC7 0153 158E" (normal string) to 00A9 8AC7 0153 158E (hex format).

 

Thanks.

 

Koh

0 Kudos
Message 1 of 6
(3,284 Views)

Hexadecimal String to Number or Scan from String.

 

You will probably need to do this in a loop.

0 Kudos
Message 2 of 6
(3,278 Views)

Does it mean that I need to loop the string 2 extract the blocks, use "string to byte array" to convert to number, then use "number to hex string"?

 

Example:

"00A9 8AC7 0153 158E"

 

Get 00A9, convert to byte, convert to hex. Then repeat for the next block.

0 Kudos
Message 3 of 6
(3,269 Views)

Below is the example to convert hex string to normal string. How should I do the reverse of this?

 

hex_string_to_normal_string

0 Kudos
Message 4 of 6
(3,258 Views)

it's fine now. I have succeed in converting it back. I have attached the sample. Please do provide feedback if it can be improved further.

0 Kudos
Message 5 of 6
(3,241 Views)

You should use the Quotient & Remainder instead of the divide.  That will keep it all as an integer.  I also made up an alternative.  Hard to say which one will be more efficient without doing some benchmarks.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(3,215 Views)