LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

twos compliment

How do you convert a hexidecimal I16 number to it's 2's complimnet number?

 

thanks

0 Kudos
Message 1 of 19
(6,939 Views)

I realize that it is new and not many people have heard of it, but there is this wonderful new service called "Wikipedia" where you can find all sorts of interesting information on two's-complement, including this jem:

 

https://en.wikipedia.org/wiki/Two%27s_complement

 

Mike..


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 19
(6,926 Views)

Oh my, number two, you sure are looking even today!

Message 3 of 19
(6,918 Views)

Negative signed integers are stored as two's complement (not compliment, thank you!), no need for conversions.

Message 4 of 19
(6,913 Views)

I just realized that I asked my question wrong....

 

I have a 2's complement hexadecimal number and I want to convert that over to a normal hexidecimal number.

 

I tried the following but I get the following error:

 

 

2s compliment error.jpg

0 Kudos
Message 5 of 19
(6,871 Views)
  • Define "normal".
  • You cannot wire an array to a conditional terminal.
0 Kudos
Message 6 of 19
(6,865 Views)

The data that  I am receivng is hexidecimal 2's complement and what I mean by a normal hexadecimal number is a hexidecimal number without the sign bit. Do I need to remove the sign bit (8000h if it is a negative #)  and subtract 1?

 

If  I knew how to do all these calculations to a cluster of all I16 numbers and then place these into a string to display on my front panel, then  

I might not need use an array at all.

 

Thanks for the advice

 

 

0 Kudos
Message 7 of 19
(6,855 Views)
It is still not clear. So should the output be a 15bit positive integer that is the absolute value of the original? Why not just take the absolute value then?
0 Kudos
Message 8 of 19
(6,844 Views)

A 15bit positive integer that is the absolute value of the original sounds good to me...

 

How do  I do that?

0 Kudos
Message 9 of 19
(6,833 Views)
Look in the numeric palette....
0 Kudos
Message 10 of 19
(6,830 Views)