Int, Real, Word?

ason

Member
Join Date
Oct 2005
Location
Home
Posts
317
Hey, dont get this, when to use what, and what can it hold,
I almost use Simatic Manger and GX IEC developer at work for maintenance and small changes.
i have search for an answer but cant find anything that is explain in a easy way.

Word= 0-65535
Integer=?
REAL=?
Floting point=?
 
go into simatic manager and open any block, go to help and contents, that takes you to the manual.

The appendices hold full format descriptions
 
ason said:
Hey, dont get this, when to use what, and what can it hold,
I almost use Simatic Manger and GX IEC developer at work for maintenance and small changes.
i have search for an answer but cant find anything that is explain in a easy way.
Word= 0-65535
Integer=?
REAL=?
Floting point=?



Word = Integer

REAL = Floting point
 
Word = (16 bits, three-digit BCD number with sign) -999 to +999
Double word = (32 bits, seven-digit BCD number with sign) -9 999 999 to +9 999 99

INT = (16 bits) -32768 to +32767
DINT = (32 bits) -2 147 483 648 to +2 147 483 647

Floating-point numbers according to the ANSI/IEEE standard
-3.402 823E+38 to -1.175 495E-38
and 0 and
+1.175 495E-38 to +3.402 823E+38


More information in Appendix A.3 (Data Types and Parameter Types) in manual: Programming with STEP 7 (6ES7810-4CA08-8BW0)
 
...

I use integers for values up to 32768, an analogue input in S7 usally is a value between 0 and 27648 that represents the analogue value 0 to 10V or 4 to 20mA ...

When I wanna calculate with this value, then I convert it to real for the higher resolution (decimal point), something like this:

L PIW 320 // Analogue inputvalue
ITD // conversion to double first
DTR // convert to real
.
.
.
Real = floating point !




ason said:
Hey, dont get this, when to use what, and what can it hold,
I almost use Simatic Manger and GX IEC developer at work for maintenance and small changes.
i have search for an answer but cant find anything that is explain in a easy way.

Word= 0-65535
Integer=?
REAL=?
Floting point=?
 
Binary, Integer and Real are the types of number that you will normally use in a PLC.
Binary can only have two values 0 or 1, Off or On.
Integer numbers don't have a decimal point and so can only be whole numbers.
Real or Float numbers do have a decimal point and so can be numbers like 3.142.

Bit, Word, and Double Word are the things that you store the numbers in.
So a bit will store a Binary number.
A word will store a small Integer number.
A Double Word will store either a Real number or a large Integer number.

How to choose an Integer or Real
It can be tempting to use Real numbers all the time because it be any value you want with or without numbers after the decimal point. But Real numbers always need the storage space of a Double Word and Real calculations usually take longer than Integer ones. Also Real numbers are less accurate than Integer ones because of rounding, for instance get your calculator and divide 1 by 3 and you get 0.33333 (may be more or less 3s depending on the screen size). But that isn't the true value, you would have to have an infinite number of 3s to truly represent 1/3. If you now multiply 0.33333 by 3 you get 0.99999 which is nearly the 1 we started with, but not quiet, it is an inaccurate 1. So use Real where you need to but use Integer wherever you can.

Word Or Double Word
Real numbers always use a Double Word so for them you have no choice but Integers can use either, and it is all about size. If you were asked to move two gallons of water would you choose to use a 5 gallon bucket or a 60 gallon drum, the bucket is more appropriate because that is the best fit. Same when it comes to Integers if you have a small Integer and any maths you do on it will result in a small Integer then use a Word size of storage. If you have a large Integer or any maths you do will result in a large Integer then use a Double Word size. There are exceptions to this rule, if most of the time a Word length will be OK but occasionally you need Double Word then you can convert from Word to Double and back again. But generally stick to the rule and you won't go wrong.

What vaules can a Word and Double Word hold
This totally depends on your PLC and how many bits it uses in its calculations but listed below are the current norms for 16 bit system:
Word can hold 65535 without a + or -, or -32767 to +32767.
Double Word can hold 4294967295 withou a + or -, or -2147483647 to +2147483647

If you want to see where these numbers come from the start calculator in Windows and choose scientific from the View menu. Click on Bin and then enter a value of 16 1s. Click on Dec and it will convert that value to Decimal.

Hope that helps.

Bryan
 
I know you're using Siemens, but AB ControlLogix performs some calculations faster (like multiply, divide) with real numbers compared to integers.
 
BryanG said:
What vaules can a Word and Double Word hold
This totally depends on your PLC and how many bits it uses in its calculations but listed below are the current norms for 16 bit system:
Word can hold 65535 without a + or -, or -32767 to +32767.
Double Word can hold 4294967295 withou a + or -, or -2147483647 to +2147483647

Correction : The ranges for 16-bit and 32-bit signed integers are :-

-32,768 to +32,767
-2,147,483,648 to +2,147,483,647
 

Similar Topics

I am having problems expressing an ANALOG OUTPUT 16bit INT word (0-10V Proportional Valve Voltage) as a REAL decimal number. From my...
Replies
6
Views
9,127
S7-400 Converting (MOVing) from a REAL Calculated (Temp parameter) value that I am trying to convert into either an INT or Word format. Here's...
Replies
4
Views
2,553
Hi all. Me again still learning Rockwell. So I'll be polling an INT data array from a Modbus SE power meter with a L82 (with a Modbus ProSoft in...
Replies
56
Views
1,354
I seem to be making this harder than it should be, and Its not making any sense. I simply need to move a real variable to two integer variables...
Replies
8
Views
975
Situation: Single [EQU] instruction with single [OTE] on a rung, nothing else/simple. [EQU] operand(A) is a real number data type...
Replies
16
Views
2,579
Back
Top Bottom