LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate 2byte hex value for a given knob value

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

0 Kudos
Message 1 of 8
(3,458 Views)

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:

 

hex bytes.png

 

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

Message 2 of 8
(3,441 Views)

@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?



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
Message 3 of 8
(3,412 Views)

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

0 Kudos
Message 4 of 8
(3,399 Views)

Why not just do this?

HexCapture.PNG

It's all in the properties!

========================
=== Engineer Ambiguously ===
========================
Message 5 of 8
(3,393 Views)

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

0 Kudos
Message 6 of 8
(3,389 Views)

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?

 

 

0 Kudos
Message 7 of 8
(3,380 Views)

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.

0 Kudos
Message 8 of 8
(3,375 Views)