LabVIEW

cancel
Showing results for
Did you mean:

2's complement

Hi anyone got any nice ways of converting 12bit 2's complement into its decimal format?
Message 1 of 22
(18,237 Views)

Re: 2's complement

Hello Paul,

I hope, I that I understood right.

The VI in the attachment creates the 2´s complement and shows the decimal value. It´s for 8 bits.

Regards ThomasD

Message 2 of 22
(18,203 Views)

Re: 2's complement

Hello PaulMc,

here is my solution to converting 12 bit Two's complement to decimal.

I hope I did not make any faults 🙂

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 3 of 22
(18,179 Views)

Re: 2's complement

Hi,
Here is my solution.

Xu
Message 4 of 22
(18,158 Views)

Re: 2's complement

Hello Xu,

your solution seems to have problems with negative numbers...

I included a similar method to yours in my example.

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 5 of 22
(18,138 Views)

Re: 2's complement

Hi guys

My own solution had a problem with 0x800, it would equal 0 and not -2048, but all other values worked.

Cheers

Message Edited by PaulMc on 10-25-2005 02:47 AM

Message 6 of 22
(18,136 Views)

Re: 2's complement

Hi guys,

one more try - dac12bit.vi............ - used as sub.vi  for  12 Bit ADC  MAX168
with possibility to decide, if the IC is used in unipolar or bipolar mode.

Find it in Diagram of MAX168.vi   ( controlled via LPT - Port ).

Regards
Werner
Message 7 of 22
(18,104 Views)

Re: 2's complement

Hi GerdW,

You are right, My vi was wrong. I forgot to set the default values of the "32-bit" controls on the frontpanel to FALSE.

Try this corrected one, please. Hope no error this time.
Thank you,
Xu

Message 8 of 22
(18,079 Views)

Re: 2's complement

Did I modify this correctly to work with 16 bits?
Message 9 of 22
(17,987 Views)

Re: 2's complement

sorry Christian,

if you would send your code again ....- with   LV 7.1 code attached