LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing negative value to positive in cluster

Solved!
Go to solution

Hi everyone, i am a student with a small knowledge on labview.
I just have this confusion, here is my project in attachment, on the variable called dInputSFP, when i insert it into a cluster, it changes the positive value to negative, although i have checked the "adapt to source".
Any idea? Help? I can always just create a new numeric indicator and just put it inside, but I would love to understand why it changes. Hope you guys can help. Thank you.

 

 

Download All
0 Kudos
Message 1 of 5
(5,057 Views)

I can't open your file but I'm going to bet that the representation of the number is set to U16 or U32, which is an unsigned integer (only positive numbers).  Right click the control and change it to a signed integer (I16 or I32). 

 

Edit:  I misread your post.  You said it changes a positive number to negative. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 5
(5,047 Views)
Solution
Accepted by topic author asyrafrcks

Your shared variables are U16 (unsigned 16 bit) which have a range of 0-65535

Your cluster uses I16 (signed 16 bit) which have a range of -32768 to 32767.  So the large half of the numbers of a U16 can't fit into a I16.  The highest bit is the sign bit in an I16.

 

You need to have consistency in your datatypes.  Make the cluster have U16 arrays to match the shared variables.  If you need numbers that are larger than 32767, but also need to have negative numbers, then you need a larger datatype such as an I32 consistently used.

 

Turn on context help (Ctrl-H) and hover over the various wires.

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

cheers man! It worked.

0 Kudos
Message 4 of 5
(5,035 Views)

This is what I use.

0 Kudos
Message 5 of 5
(4,511 Views)