LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2's complement

Sorry about that...

I think this one should work:

0 Kudos
Message 11 of 22
(7,976 Views)
hi again,
 
your vi works perfect  -  both ways ........... - no comment neccesary.
 
Werner
 
P.S. For poeple with   ADC's and Uni/Bip.- mode.... my old styled vi attached with 16 bit resolution
0 Kudos
Message 12 of 22
(7,966 Views)
Many times, the 12 bit 2s Complement is not a boolean array, but contained in e.g. a single 16 bit Integer. In this case, you don't need to jump through all these hoops converting to a boolean array, etc.
 
You can just do the bit operations directly as shown in the attached VI (LabVIEW 7.0). Seems much more efficient. 🙂
 
(VI is not fully tested, please verify correct operation. You might want to add an error condition if any of bits 13-16 are set).
Message 13 of 22
(7,951 Views)
Here is a modified version of Altenbach's 16 bit Integer version. the same idea as my boolean array version posted above. I think the algorithm is more simple and faster.

Xu
Message 14 of 22
(7,912 Views)
Here is a modified version of Altenbach's 16 bit Integer version. the same idea as my boolean array version posted above. I think the algorithm is more simple and faster.

Xu
Message 15 of 22
(7,910 Views)

Nice but you did not drop the sign bit

0 Kudos
Message 16 of 22
(4,256 Views)

796

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 17 of 22
(4,247 Views)

my two cents to raise the thread from the dead

 

works for arbitrary bit sizes

Message 18 of 22
(4,218 Views)

I have attached a 12 bit 2s complement I used for temperature senor TMP100. The Negative numbers are represented in binary twos complement format and has a resolution of .0625C per count.

 

 

Message 19 of 22
(4,180 Views)

Is this the same result? No, not exactly.

 

It's the same except for 0x80012 bit 2th complement.png, that value (-0?) gives a bad result.

0 Kudos
Message 20 of 22
(4,176 Views)