10-09-2013 08:18 AM - edited 10-09-2013 08:19 AM
Hey,
My problem is : I have to convert a decimal number to hexadecimal to send it. So, I use the fonction "convert number to hexadecimal string". I connected the output with an indicator.
But it doesn't work for my case because when I choose (with left click) hexadecimal display I don't have the "good" thing. For "normal display", the hexadecimal number is good.
An exemple : Decimal 200, convert to hexadecimal in normal display : 8C & in hexadecimal display : 3843.
Actually my instrument receive "3843" and it don't work.
Thank You
10-09-2013 08:41 AM - edited 10-09-2013 08:53 AM
Post your code so we can see what is happening.
Also, did you do any search before posting? There are a number of discussions on this topic, one for instance:
10-09-2013 08:53 AM
Hi Hreidmarr,
I think I understand what you are saying.
Do you need to change the string control to the Hex display? The hex display is showing the ASCII representation of the hex string. If you leave it in normal display you will get the hex value you expect.
i.e. 200 = C8
Olly
10-09-2013 09:11 AM - edited 10-09-2013 09:12 AM
This!
For more details, screenshot and my code
I think my device doesn't work because it read the normal value but it need the hexadecimal value
10-09-2013 10:25 AM
I don't think that's why your device (whatever it is) doesn't work. That is the standard way to send a hex number. Now, if your device requires that the characters be sent in reverse order ("little endian" instead of "big endian" - or maybe the other way around), then maybe sending it 0x3843 (for 200 decimal) may be the trick. There is a LV function to reverse the byte order.
Cameron
10-09-2013 11:02 AM - edited 10-09-2013 11:03 AM
If you want to see "C8" when setting the string to hex display, I assume that the number is U8 and you want to send a single byte. (I am not sure why you are using DBL representation in your attachment, so change that!).
Simply typecast the U8 numeric to a string as shown and you should have all you need.