LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can be represent -10 in Hex in LabVIEW

Hello All,

Can anybody tell me how to represent a –ve number in a Hexadecimal format? (How do u will represent -10 in Hex)

If anybody is having any readymade utility

Thanks and Regards.
0 Kudos
Message 1 of 5
(3,359 Views)
Lets say we have 32 bits to work with.

The first 16 bits is for positive numbers and the last 16 bits is for negative numbers.
Only thing you have to watch out for is negative numbers count backwords in HEX. See example below.

decimal 2 = hex: 0000 0002
decimal 1 = hex: 0000 0001
decimal 0 = hex: 0000 0000
decimal -1 = hex: FFFF FFFF
decimal -2 = hex: FFFF FFFD\
...
etc

So -10 decimal is FFFFFFF6


LabVIEW can do this easy enough. Make an indicator, right click for properties and change it to HEX display.
See code below:
0 Kudos
Message 2 of 5
(3,348 Views)
The hexadecimal representation just shows the pattern of bits, what they actually mean depends on the representation.

For example a "-1" in I8 representation is FF, while the same FF in U8 representation would mean 255.

What exactly are you trying to do? For example, if you need to send a negative number to an instrument in hexadecimal form, you would need to know what data type the instrument expects. Please provide more details on your exact problem.
0 Kudos
Message 3 of 5
(3,348 Views)
A -10 is F6 in hex if you are dealing with I8. For I16 it is FFF6, for I32 it is FFFFFFF6. To see for yourself, create a numeric indicator of either I8, I16, or I32. Type in -10. Then right click and select Format and Precision, and choose Hexidecimal. You will now see the hex representation of your number.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 5
(3,339 Views)
Use the IEEE754 Format for floating point numbers
0 Kudos
Message 5 of 5
(3,306 Views)