Twincat PLC Variable is Too Large Error

We program and integrate Beckhoff controls. Call us if you need help programming or starting up a Beckhoff system.

 Call +1 (763) 234-3407  Email nick@pcctrl.com

Posted to Beckhoff Blog on May 04, 2009


Recently, I was working on a PLC program and ran into this error message. I had created several data structures, and marked them with wildcard output addresses as shown below:

stInProductStack AT %Q*: ARRAY [1..1200] OF ST_InProductRecord;

However, I received an error in the message window when trying to build the PLC project:

Error 3801 Data(10): The variable 'stInProductStack' is too large (24000 bytes)

This did not make sense to me at first. I was trying to use this data structure to store data persistently in the CX1000 NOV-RAM, which has memory space for 128 KB  of data, so why should it get an error like this? The variable stInProductStack was only 24 KB?

Well, it turns out the error can be easily be resolved in the Options .> TwinCAT PLC menu items screen. I just increased the size from the default setting of 16 KB to 128 KB for both input and output data as shown below.

TwinCAT PLC Options

I am not really sure why the default setting is 16 KB, or if there is any performance impact related to increasing this. My guess is that since TwinCAT PLC can be targeted to multiple forms of hardware, the low default of 16 KB is used. The project built and ran without any issues or performance problems, so there seems to be no impact due to increasing this setting.