Bool[32]: Memory size?

PreLC

Member
Join Date
Apr 2019
Location
Mars
Posts
586
Hello PLCs.net!

I recently read that a bool takes 32 bits of memory, as this is the least allocation size in logix processors.

Does a Bool[32] take 32^2 bits of space?

Regards,
-PreLC
 
here's a little Boot Camp lesson in memory usage ...

start up a brand new "junk" program ... go to the Controller Properties feature – to the Memory tab ... (different software versions might have this in different locations – you might have to hunt around) ...

write down the value of Max Used (31,880 bytes in the example shown below) ....

now go and set up just one BOOL tag named X ... note that's just ONE character for the name ...

now go back to the Memory tab – press the Estimate button to update the values ... now write down the current Max Used ... (31,960 in my experiment) ....

do the math ...

so in my example, we used up 80 bytes (that's 640 bits) of our processor's memory just so that we will be able to store a single bit value of ONE or ZERO ...

now go back and delete that BOOL tag – then recheck the memory used ... you should be back to 31,880 again ...

next go and set up just one DINT tag named X ... note that's just ONE character for the name ...

now go back to the Memory tab – press the Estimate button to update the values ... now write down the current Max Used ... (another 31,960 in my experiment) ....

again - do the math ...

so in my example, we used up 80 bytes of our processor's memory so that we will be able to store 32 bit values – a double integer ... (personally, I find this kind of weird) ...

and so on – and so on ...

play around with longer tagnames ... try creating Arrays of BOOLS and DINTS ...

have fun ... stay safe – stay well ...
.

bytes_used.PNG
 
Last edited:
here's a little Boot Camp lesson in memory usage ...

start up a brand new "junk" program ... go to the Controller Properties feature – to the Memory tab ... (different software versions might have this in different locations – you might have to hunt around) ...

write down the value of Max Used (31,880 bytes in the example shown below) ....

now go and set up just one BOOL tag named X ... note that's just ONE character for the name ...

now go back to the Memory tab – press the Estimate button to update the values ... now write down the current Max Used ... (31,960 in my experiment) ....

do the math ...

so in my example, we used up 80 bytes (that's 640 bits) of our processor's memory just so that we will be able to store a single bit value of ONE or ZERO ...

now go back and delete that BOOL tag – then recheck the memory used ... you should be back to 31,880 again ...

next go and set up just one DINT tag named X ... note that's just ONE character for the name ...

now go back to the Memory tab – press the Estimate button to update the values ... now write down the current Max Used ... (another 31,960 in my experiment) ....

again - do the math ...

so in my example, we used up 80 bytes of our processor's memory so that we will be able to store 32 bit values – a double integer ... (personally, I find this kind of weird) ...

and so on – and so on ...

play around with longer tagnames ... try creating Arrays of BOOLS and DINTS ...

have fun ... stay safe – stay well ...
.

Thank you Ron, This is extremely useful for the memory-scrooge-Mc.Duck inside me. I will try as soon as I get to work Monday and see what the sizes actually are :D
 
memory-scrooge-Mc.Duck

my advice is to get over that "memory saving" attitude - sooner rather than later ...

you'll go crazy trying to trim off any "wasted" space with the RSLogix/Studio 5000 platform ... in simple terms, if you need to worry about conserving memory, then you didn't buy a big enough processor to begin with ...

for some reason this reminds me of a new customer looking over one of those great big fancy bus-sized motor homes in a dealer's showroom ... he asked, "What kind of gas mileage does this thing get?" ... the dealer said, "Sir, if you've got to ask that kind of question, then you can't afford one of these." ...

party on ...
 
Thanks Ron for the insight,

how about 1. the load on CPU processing/speed and 2. Effect on data transmission over network for bits vs Dints

I was thinking in data transmission, a single bit and Dint takes out a similar bank width
 
I have always been told that the Compact and Control Logix were built so that a DINT is the minimum the Processor will allocate for memory. So if you create a BOOL tag the Processor will allocate the same amount of memory as it would for a DINT. So if saving memory is what you are after it is better to create a DINT and use the bits of that DINT for your BOOL's. I really hate doing that because it can become very hard to read the program. You end up with tags that have very "general" names like ALARM.0, ALARM.1, Alarm.2 and so fourth. I like to use Tag names with better descriptions like Tank_1_Hi_Level, Low_Pressure_Alarm , Ect. I feel that tags with better discriptions help with reading the program and knowing what is going on even-though the use up more memory.

I was pretty curious so I just did Ron's experiment using a L30ER as the Processor and here is what I found:
Creating a Bool named X
Used 88 Bytes of Memory
Creating a Bool named THIS_IS_A_VERY_LONG_TAG_NAME_FOR_X
Used 120 Bytes of Memory
Creating a DINT named X
Used 88 Bytes of Memory
Creating a DINT named THIS_IS_A_VERY_LONG_TAG_NAME_FOR_X
Used 120 Bytes of Memory


So what I have been told is correct. The Tag name's length seemed to have a big difference on the memory used.



As Ron has said if you need to be this cautious on your memory usage you don't have the correct processor. Get one with more memory and program so that is makes sense and is easy to read and understand. That will end up saving money in the long run.
 

Similar Topics

I received the following message via PM, and am posting here publicly to help others. ============================================ I had a...
Replies
10
Views
1,012
Greetings. I have a 1769-L30ER that runs a new piece of equipment my company bought. I would like to read from and write to some tags on this PLC...
Replies
7
Views
1,424
I need to move a large Bool array to Word array in Schneider Control Expert. Is there an easier way to do this? For example: Bool[128] array to...
Replies
4
Views
1,336
I work at a cheese factory and we recently ran into a problem where in an older controller they where able to use a REAL Data type in OTU and XIC...
Replies
13
Views
2,574
Hello all! Is it possible to COP a SINT array to a UDT structured the same as a SINT array, except all BOOL bits? I have a module that has an...
Replies
5
Views
3,162
Back
Top Bottom