Signed / Unsigned integers with a PanelView

shoelesscraig

Member
Join Date
Apr 2009
Location
LA
Posts
382
Ok, I just want to make sure I'm understanding this correctly. I know that in PanelBuilder32 I can select signed or unsigned integers. I have always choose "unsigned" for everything that I do, and I'm strictly an Allen-Bradley PLC guy. But, if I understand correctly, AB PLC's work ONLY with "signed numbers"...??? So, I am wondering...Since the PV's that I have built are always displaying numbers less than 32767, is this why I have never noticed a difference?? I mean, if I'm displaying an integer that will always have a range of 0-100 on my PV screen, and I go back and change the data type from "unsigned" like I have it now, to "signed", it will display the same, right??

I only ask because the next project I do will have to display numbers that may be in the 150,000 to 250,000 range. So, I'm assuming that I need to use a "floating point" number in the SLC (even though there will be no decimal point) and use the "signed" data type on the PV?? Does this sound right? Or does it still not matter whether I use signed or unsigned in the PV with this setup??
 
If you choose unsigned in the Panelview, you can display values from 0-65535. In RSLogix, you will see negative values when the integer is greater than -32767, and any math operations treat the value as signed.

To get values up to 200,000 you could use a float, or back to back integers.

Note that a float is an approximation and can give you trouble in certain situations:

http://www.plctalk.net/qanda/showthread.php?p=255399#post255399

Paul
 
Thanks Okie. I've learned yet another piece of info from you.

Let me ask this to make sure. I understand that (and how) floating points can be an approximation. But, this should not affect me at all due to the fact that I am STRICTLY dealing with whole numbers....correct?
 
The point where resolution begins to affect floating point whole numbers is 2^24-1, so as long as you are always less than 16,777,215 and using only whole numbers you are good to go.
 
Alaric, I will always be WAY below that, so I'm good. But just for learning purposes, and if you don't mind, could you explain why resolution comes into play after that even for whole numbers??
 
Floating point devotes some of the bits to storing the position of the decimal point (floating you understand). Once the number gets above 24 bits then the decimal point (actually a binary point) gets bumped. let's look at a decimal analogy:

We get 5 characters to store the number (mantissa) and one (with sign) to store the decimal point position. The decimal point position start at zero. So we count up. Everything is fine until we approach 99999. Now we add one more. Oh-oh. The decimal point position goes to 1 and the mantissa is set to 10000. That means the number is 10000 plus one decimal point shift to the right (with a zero added). Ok, we can take that. Now add one more. You can't. You can add 10 more, all at once to get 10001 plus one decimal point shift to the right for a total of 100010. But, with this system you CANNOT represent 100001 through 100009.

A similar limitation exists in the 32 bit floating point system. In fact no fixed number of bits or characters system can represent all numbers. There is always a point where they break down. With integers (16, 32, 64 bit) it's fairly understandable. But 'floating point' sounds somewhat mystical. It can do anything! - Wrong.
 

Similar Topics

Is there a way in CX-Programmer to ad UINTs together with an instruction without a compiler warning. Ladder Rung: Warning: Instructions...
Replies
2
Views
1,238
Hello All, Quick question, in Logix 5000 i noticed that you cannot specify a UINT data type (Integer that cannot accept negative numbers) only...
Replies
8
Views
9,006
Hello, I'm using the MSG command with RSLogix 500. The values are being read in as signed integers. Is there a way I can read them in as an...
Replies
10
Views
6,498
Is there any way to force Wonderware to see a number as an unsigned integer? I have Wonderware 9.5, getting numbers from an AB PLC5/80E, and...
Replies
11
Views
13,621
I'm having to make an AOI to use with a generic ethernet device because the manufacturer does not provide an AOP. I just want to do a sanity check...
Replies
13
Views
1,250
Back
Top Bottom