Memory usage

The CX7000 has 32 MB of RAM that is used by the firmware (TC/RTOS) and TwinCAT (TwinCAT memory). The TwinCAT memory is further divided into the router memory and the PLC memory. The router memory is used for ADS communication and the PLC memory for the actual PLC program including TcConfiguration, mapping and data.

19.1 MB of TwinCAT memory are available to the CX7000. Because the size of the memory is limited, it is important to control the memory usage and to adapt your PLC project if it is exceeded.

Router memory

On the one hand, you can adjust the size of the router memory in TwinCAT and set a smaller router memory depending on the ADS communication actually used.

Memory usage 1:
Settings for router memory in the TwinCAT System Manager.

By default, a value of 32 MB is entered in TwinCAT, which in turn is limited to 9 MB for the CX7000 because of the small RAM in the CX7000. A router memory of 9 MB is usually much too large for a small controller. A router memory of 4 MB is recommended for the CX7000 and can be even smaller if little to no ADS communication is used. However, a router memory of at least 1 MB should be adhered to and should not be any smaller. You can determine how much router memory is used with the function block FB_GetRouterStatusInfo or alternatively with the Beckhoff Device Manager.

Note that the router memory is only re-created with a power off/on of the CX7000. A TwinCAT restart is not sufficient. The rule of thumb is: The smaller the router memory for ADS communication is set, the larger the application can be, i.e. the PLC program, TcConfiguration, mapping and data.

Determining the memory usage

With the function block FB_GetRouterStatusInfo, or alternatively with the Beckhoff Device Manager, it is possible to determine how large the memory requirement of the router memory is.

Memory usage 2:
Utilization of the router and TwinCAT memory.

The Router display can be used to determine the memory requirements of the router memory. In this example, 20.5 kB of a maximum of 4 MB are occupied. The TcOs display shows the total memory consumption of the TwinCAT memory including router memory and PLC program. In this example, 7.1 MB are occupied in total.

With the help of this display, the size of the PLC program can also be calculated, since the router memory is fixed at 4 MB and is part of the TwinCAT memory. If you subtract the 4 MB from 7.1 MB, therefore, the PLC program occupies 3.1 MB.

Memory reserve

Since in this example the TwinCAT memory occupies 7.1 MB of 19.1 MB, a reserve of 12 MB remains for the PLC program. Note that more memory is needed for a short time for an Online Change in TwinCAT. If you want to use the Online Change function, it is advisable to always have a certain reserve. In the most extreme case, twice the currently consumed PLC program may be required to perform an Online Change. An error message is displayed in TwinCAT if there is not enough memory available for the Online Change.