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
(5,273 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
(5,263 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).

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 13 of 22
(5,248 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
(5,209 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
(5,207 Views)

Nice but you did not drop the sign bit

0 Kudos
Message 16 of 22
(1,553 Views)

796

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 17 of 22
(1,544 Views)

my two cents to raise the thread from the dead

 

works for arbitrary bit sizes

Message 18 of 22
(1,515 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
(1,477 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
(1,473 Views)