NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Threads
Posts: 3
0 Kudos
Accepted Solution

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

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.

Knight of NI
RavensFan
Posts: 13,222
0 Kudos

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

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.

Member
Alexander_Sobolev
Posts: 97

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

 

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.

Member
Threads
Posts: 3
0 Kudos

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

Thanks for your help.  It's working now.

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page