Difference of Integer and Word..

Jumbo, I also took a university corse and I am a bachelor.
But, who realy helped a begginer who asked for a help?
You, wo tells him about Abraham and Moses, or me, who told him that in THIS conference, about PLC-s, WORD IS ALWAYS 16-bit?
Pseudo-intelectual talks intended to confuse someone or intended to present someone as an 'expert', do not help anyone.

Is it?

There was no intention to confuse. More confusing would be learn it is 16bits when it is not always. By knowing that there is words and words, you know you might need to check if it is.

And it was not you who said it first. Why did you get so offended that you started going personal.

Ps. I have no need for ego boosting telling what education i have or are having. Nor does it really mean anything. There is difference in being a Bachelor in Engineering and being a Bachelor in Engineering.
 
Last edited:
Hi Guys...

Can anyone tell me the difference between Integers and Words?
quite confuse because..
some PLC uses Integers some PLC uses word when it comes to analog input..


Thanks guys!

An integer is a whole natural number. The definition of an integer has absolutely nothing to do with a computer.

In a computer a number (whether it is an integer or a real number) is represented by a series of bits. The computer processor addresses these bits in groups, or words. Different computers use different size words. One of the computers I worked with early in my career was a DEC PDP8A. It used 12 bit words, and words is what they were called. Back then another popular processor was the Z80 processor. It used 8 bit words. Once again, we refereed to those 8 bit chunks as as words, although at 8 bits the term bytes was just as appropriate. Both term were used interchangeably when we were talking about z80 architecture, but they were not interchangeable when talking about DEC PDP8 architecture.

Now this thread has seen lots of chest beating and parading of credentials, but one fact remains, back in those days we used the term "Word" to refer to the native data size for both the DEC PDP-8A and the Z80 processor, and each one was different, and neither one was 16 bit.

Now if you are talking to someone who uses the ControlLogix PLC and you start talking about words then you are talking about 32 bit long chunks of data. The CLX normalizes its data to 32 bit words, so whether you define a single boolean tag, a 16 bit integer tag, a DINT tag, or a real tag, the CLX is going to allocate a single 32 bit word for the data.

So you see, the exact meaning of "word" changes within the context of processor architecture.

Now back to the integer. An integer is a whole natural number. In a computer, if you have a 12 bit word then the max size of a single word integer is 4095 unsigned, or +2047 to -2048 signed. If it is a 16 bit integer then the max size of a single word integer is 65536 unsigned, or +32767 to -23768 signed. You may wonder how that is determined. Since numbers are represented in binary in the computer, then the max unsigned integer is 2n where n is the number of bits used in the integer word. If the computer is using two compliment numbers to represent negative numbers then the highest order bit is reserved for a sign bit and then the integer size is defined as -2n-1 to +2n-1-1.

Now I want to take a second and point out that I said 'max size of a single word integer' above. That is because it is possible to construct data so that a very large integer number can be represented by spanning across words. In that case the largest integer that you can represent is limited only by the memory available to your computer and your programmer's patience.

Now for your final question. You mentioned analog inputs. The analog input is processed through a circuit called an analog to digital converter. An A/D converter has a resolution defined in bits, and that is independent of what a processors word size might be. For example, a PLC might have a 12 bit A/D converter or a 16 bit A/D converter. The more bits an A/D converter has the better its resolution. The A/D converter converts the raw analog input to a number in the range 2n, where n is the number of bits that the converter uses. The PLC starts with that value as a raw integer. You as the user may scale it to to whatever engineering units you desire and convert it to a floating point number.

If you want to know more about how floating point numbers are stored in your PLC do a search on this forum on IEEE 754. I and others have covered that topic in detail in other posts.

I hope that helps.
 
Last edited:
So, anyone tell me, is a word 'HELLO' 32-bit or 64-bit?

Since Homer brought it up using the word 'Hello', I think that is a good segue into talking about what 'word' means. Lets start with the generic definition of a word. A word is the smallest free form linguistic construct that might be spoken, heard, written, or read that in isolation has a practical semantic meaning. Since we humans are really very good at abstraction then a word can be very small or very large and it can mean something very simple or it can mean something very complex. 'Hello' is a good example of that. In context it can convey anything from simple acknowledgment, to friendly greeting, to complex intimate emotions.

Computers however are not very good at abstraction. So when a computer retrieves data from memory, what size is that data? Some computers retrieve it in 8 bit chunks, some in 16 bit chunks. Most personal computers now retrieve it in 64 bit chunks. Even though we humans might be interested in the information stored by just one bit, because of its architecture the modern computer processor has to pull a full 64 bits from memory every time it reads it. So, in the context of the computer processor (not us humans), what in that case is the smallest construct that might be written or read from memory? That then is the definition of a word. Since diplomacy is a word too, all of you are right.... just some are right only in certain specific contexts, and some in more general contexts. 🍺
 
Last edited:
You guys are arging for small stuff.
Integers have a sign bit. Words do not. Simple.
The size depends on the processor. Most ( I haven't seen any that don't and we have a lot of different PLCs ) PLCs assume both WORDs and INTs to be 16 bit but in C this isn't so. The size of WORDs and INITs is usually a minmum of 16 or the register length used for WORDs and INTs.

There are Motorola DSPs that have 24 bit registers and memory. WORDs and INTs are 24 bits but the difference is that INTs are signed values and WORDs are not.
 
Hi Peter, What about an unsigned integer? :)

My understanding, is that a Word is a group of bits (Size to be determined by CPU). Integer refers to how a number in a word or group of bits is interpreted. One deals with size, the other with content.
 
Hi Peter, What about an unsigned integer? :)
Different systems treat them different ways. In C an unsigned short int is the same as a WORD. In C one can do math WORDs or unsigned shorts ints.

PLC programming enviroments differ but in the IEC 61131-3 a WORD is a colleciton of bits that doesn't allow math but does allow boolean operations such as AND, OR, XOR etc. If I want to count from 0-65565 I can't unless I use a DINT. This is all nuts in my opinion. It would have been bettter if IEC defined a UINT so I can do math from 0-65535.

My understanding, is that a Word is a group of bits (Size to be determined by CPU). Integer refers to how a number in a word or group of bits is interpreted. One deals with size, the other with content.
It depends on the system.

The IEC specification is pretty clear about it because it is NOT tied to any particular CPU WORDs and INTs are ALWAYS 16 bits. The idea is that the same code will run on ANY IEC system using ANY microcontroller.

This is fine but the wise people, NOT, in IEC land didn't think about what happens if the IEC implmentation is on a DSP. The DSP we use only has 32 bit registers. When writting C code a BYTE, CHAR, INT, WORD ( unsigned short int ) , LONG ( DINT ) or DWORD ( unsigned long ) are all 32 bits long!!!! There are no 16 bit or 8 bit operations. When reading a character out of a serial port and storing it into memory it still requires 32 bits.
 
i don't want to add fuel to the fire, but aww heck why not !!

Alaric's excellent post (#20) is the closest to my interpretation - and then some ! wtg (y)
 

Similar Topics

We have remote IO 1734-AENTR and all of them seem to be recognized in Logix except in, RIO-5000. When we look at the revision, all the ones that...
Replies
4
Views
756
From a FAT it appears that a struct containing bits/int/real can't be sent from a 1513 to a 1200. When using two 1513 there is no issue. Total...
Replies
5
Views
703
Hello, I have a problem with AO- and AA-Tags. When I use for example the tag AO_Test with the address 200 and type the value 1,2 in, the AA-Tag...
Replies
7
Views
1,431
Hi; We installed an orifice plate type steam flow transmitter which configured to give 4-20mA signal correspond to 0-9ton. I given that signal...
Replies
24
Views
5,632
As per the title. This might seem like a basic question to many, but I'm unclear about the difference between a coil ( ) and an application...
Replies
28
Views
4,071
Back
Top Bottom