ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Offset binary to 2's complement

Hello.

 

How can I convert 12-bit offset binary word to 12-bit 2's complement word? Thanks.

0 Kudos
Message 1 of 4
(2,201 Views)

Hi Valentin,

 


@Valentin87 wrote:

How can I convert 12-bit offset binary word to 12-bit 2's complement word? Thanks.


What is a "12-bit offset binary word"?

What is a "12-bit 2's complement word"?

 

When it comes to LabVIEW datatypes a "word" typically is a 16-bit entity, like U16/I16. So you need to explain your input datatype and the expected result more clearly before we can help you…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,195 Views)

For example, I have dec value = 3754 (U16). I must  get value in I16 in 2's complement code.

0 Kudos
Message 3 of 4
(2,188 Views)

Lots of options, but this does the trick:

 

wiebeCARYA_0-1643025416848.png

 

If the intention is to convert to double (the 'resolution' of 0.0625 is just an example):

12 bit 2th complement.png

Message 4 of 4
(2,171 Views)