07-08-2019 06:19 AM
Hello;
I am beginner to Lab view i just need a small help i taking input from Knob and i want to generate 2byte Hex value can some one please help me on doing this please
07-08-2019 06:53 AM
If the knob is set to represent a U16 integer you can use Split Number to obtain the high and low bytes then Number To Hexadecimal String to obtain a string representation of each hex value. Something like this:
If you just want to display the byte values on the front panel, you don't need to bother with the string conversion and can set a numeric indicator to display as hex (right click - Display Format...).
Andy
07-08-2019 10:40 AM
@LarryDante wrote:
i want to generate 2byte Hex value
Please be more specific. Is that hex value in ASCII (which would be 4 characters) or in a hex editor? What is your data representing? Do you have calculations to do on the data before sending it where it needs to go?
07-08-2019 02:16 PM
Thanks for attention sir's,
Actually sir here i want to generate a 2byte hex string just like for example:
for 16byte it gives FFFF so in that manner it should scale
07-08-2019 02:27 PM
Why not just do this?
It's all in the properties!
07-08-2019 02:41 PM
but sir what my problem is i am taking numeric input and want to generate 2byte hex number for the given input like for example i set nob to 5.33 a 2byte hex value is generated for it i hope i am able to explain my problem
07-08-2019 02:58 PM
5.33 is a bad example... That's a floating point value, and in a best-case scenario you need 4 bytes to represent one using standard floating point encoding, and most people use 8 bytes.
Do you have any sort of reference for this, like a manual or spec sheet? Is this for a school assignment? Or is it to send to some sort of equipment you own?
07-08-2019 03:01 PM - edited 07-08-2019 03:02 PM
5.33 is not an integer, so it isn't going to convert to a 2-byte "hex".
Are you trying to rescale your 5.33 value so that it is somewhere between 0 and 65535 (0000-FFFF hex)? If so, what decimal value is supposed to be scaled to FFFF? Is 0 supposed to be 0000? Most likely, (without any clear details), you'd divide by your max value and multiply by 65535.
I feel like you don't know exactly what you want so you don't know how to ask the question.