From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1's complement

Solved!
Go to solution

Hi,

I want to convert my data into 1's complement so can anybody suggest any soluton for that. Here i have attached my vi so according to this if i put my knob at -1 i am getting data after hex conversion is FFF  and for +1, 001 but instead of that i want 000 and FFE repectively.

 

Thank you

0 Kudos
Message 1 of 5
(3,368 Views)
Solution
Accepted by topic author spv162

Hi spv,

 

seems you need to subtract 1 from your conversion result:

check.png

Atleast this works according to your examples…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,361 Views)

This sort of does what you want except there are 4 characters Hex string when knob is greater than -1

 

Ken

0 Kudos
Message 3 of 5
(3,358 Views)

Thank you all i got my result.

0 Kudos
Message 4 of 5
(3,339 Views)

Hi spv,

 

according to Wikipedia "one's complement" is defined a little different to your explanation…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(3,331 Views)