Bits vs integers

sweetjohnny

Member
Join Date
Feb 2012
Location
Iowa
Posts
55
I've been programming PLC's for a few years now and I recently came across something I have no answer for or reasoning why or why not.

The question is based from programs using RSLogix 500

Question: Why would one guy use a bit(B) where another uses an integer(N)? For example a simple rung using an input to trigger a couple different things in the program. In one program a bit is used to trigger the different items in the program and in the other an integer(N) to do the same thing.

I am just curious why. They both work the same. But i cannot explain why or why not one way or the other.

I am unable to post pictures for examples.
 
If I follow, the question is why would someone do

If bit==true then do x
vs
If Int.0==true then do x

One possibility - Some HMI packages had tag based limits, like Fix32 for example. You could pack bits into WORDS and use an offset inside the HMI to use a smaller tag count licence.
Another - Using the bits of a WORD let you perform fun bitwise shifting and boolean algebra functions, along w/ moves and copies.
Lots of other possible reasons.
 
Mainly, on old hmis you had to transmit the data as integer words. The other reason, as explained to me by a fantastic automation engineer is the fact that the programmer learned how to do it that way, so that is how they did it.

You can also pack more data into an integer file than a bit file.
 
Another reason may be data packing. We used to have to be very careful about sending data in packets to make sure we did not bog down our communications. In an instance like that it would make sense to pack your bits into an integer word that was being sent in that packet.
 
One thing to remember is that by packing bits into a byte, your task of creating your SCADA can greatly be simplified if the bits all follow a standard.

For example, say that your byte has bits that tell you if a valve is opened, closed, faulted, and several alarms/faults on the rest of the bits.

You can then program a faceplate that will take a byte and animate that object with a single byte instead of listing and adding all the different bit length tags.
 
I might also think of someone who came to Rockwell world from the worlds of other PLC brands, where all the internal memory is not split into "files" of different types but where a same memory location can be addressed by either bits or bytes or words or double words or whatever. They just feel more confident and comfortable this way.
 

Similar Topics

Hi I am being given several fault words (as a DINT) from a Drive that I am receiving into a Compactlogix L33ER controller. I have a small...
Replies
12
Views
1,100
Dear Fellows; I am working on a very old machine which is designed in GE 90-30 PLC system. I have some difficulties like 1. How a force to...
Replies
3
Views
298
Hi All, I am trying to write some simulation logic for an existing project im working on. Does anyone know if this is possible to write to...
Replies
6
Views
1,259
Hi, I have this code: LAR1 P##structy L 0 T LW [AR1,P#0.0] which resets all the bits in this struct called structy...
Replies
1
Views
634
I am passing DINTs between a Micro800 and CompactLogix - each bit in the DINT has its own unique meaning. On the Studio5000 side I can just write...
Replies
3
Views
1,040
Back
Top Bottom