From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When I concatenate hex values in 2 different ways a get different results

Solved!
Go to solution

When I concatenate 2 strings in "hex Display" the result is what I want.  When concatenate a [decimal number converted to a Hex] with [a string in "Hex display"] the results is very different.  Attached code shows the 2 cases.  In my code, why is "LDD_Command 2" different than "LDD_Command"?  Thanks.

0 Kudos
Message 1 of 4
(4,352 Views)

Because in one case you are converting a number to a hex string, then displaying that as the hex values that make up the ASCII characters.

 

0000 hex is 0000 hex.   0000 as a string is 3030 3030 hex because is zero is the hex value 30 in the ascii table.

0 Kudos
Message 2 of 4
(4,345 Views)
Solution
Accepted by topic author Threads

 

When you convert numeric to Hex string, it gives string in normal representation (LDD_input indicator). You display it in the string with Hex representation (second part of LDD command 2), they are not equal.

If I got you right, you need to display data (0CCD is hex for 3277=u16(1/20*65535). So you need to have data with string representation - data should not change, only the way you display them should. This is done with the type cast.

Message 3 of 4
(4,339 Views)

Thanks for your help.  It's working now.

0 Kudos
Message 4 of 4
(4,313 Views)