LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2's complement

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

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

0 Kudos
Message 2 of 22
(17,937 Views)
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
0 Kudos
Message 3 of 22
(17,913 Views)
Hi,
Here is my solution.
 
Xu 
Message 4 of 22
(17,892 Views)
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
(17,872 Views)

Hi guys

GerdW your solution worked best.

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

0 Kudos
Message 6 of 22
(17,870 Views)
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
Download All
0 Kudos
Message 7 of 22
(17,838 Views)

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

0 Kudos
Message 8 of 22
(17,813 Views)
Did I modify this correctly to work with 16 bits?
0 Kudos
Message 9 of 22
(17,721 Views)
sorry Christian,
 
if you would send your code again ....- with   LV 7.1 code attached
 
not everybody around has already upgraded to LV8
 
Werner
0 Kudos
Message 10 of 22
(17,710 Views)