Command Check memory for active application
Function: The command starts a check of the memory area of the active application. The memory is subjected to various checks. The results are displayed in the message window.
Call: PLC > Window menu
Requirement: At least one application is loaded and in online mode.
The memory area of the active application is checked for the following:
- BOOL variables have defined values.
- STRING and WSTRING variables are terminated.
- Enumeration variables have valid values.
- Variables of a sub-area type have valid values.
- Variables of a constant block type (STRUCT, ARRAY etc.) are unchanged compared to their initialization values.
- Function pointer addresses are internally consistent.
- Function pointers in the project point to a memory managed by TwinCAT 3 PLC. Function pointers to library blocks or external blocks are excluded; these can be stored in external memory.
- Pointers to a type point to memory locations of this type.
- Pointers point to memory locations whose address is aligned to the type granularity, or is 0 or -1.
- Interface variables and function table pointers are internally consistent.
- The code of compiled blocks is unchanged.
Note: Compiled blocks with breakpoints are excluded from the check because the code for these is manipulated at runtime.
The results of the check are displayed in the message window. Violations of the check criteria appear as warnings (see table below).
If you double-click on a warning, the Memory view appears with the relevant position is highlighted in orange. The Memory view can also be opened with Command Show Memory View.
The check can be restricted using the 'memory_check' attribute.
ID of the warning if the check criterion is not met. | Test criterion |
|---|---|
MC0001 | BOOL variables must be either 0 or 1 in the memory. |
MC0002 | Enumeration variables may only accept values that are defined in the enumeration. |
MC0003 | Variables of a sub-area type may only accept values within the sub-area. |
MC0004 | All strings must be 0-terminated. |
MC0005 | Pointers must always point to addresses that have the correct alignment. Pointers must point to memory locations whose address is aligned to the type granularity, or is 0 or -1. |
MC0006 | Pointers must point to memory within the application. |
MC0007 | Pointers must refer to variables of the correct type. It would not be correct, for example, if a POINTER TO STRING pointed to a REAL. |
MC0008 | Internal consistency of compiler structures Function pointer addresses must be internally consistent. |
MC0009 | Internal consistency of compiler structures Interface variables and function table pointers must be internally consistent. |
MC0010 | Internal consistency of compiler structures |
MC0011 | The downloaded code must not have changed since the download. The code of compiled blocks must be unchanged. Information: Compiled blocks with breakpoints are excluded from the check because the code for these is manipulated at runtime. |
MC0012 | The value of a constant must not have changed since the download. Variables of a constant block type (STRUCT, ARRAY etc.) must remain unchanged compared to their initialization values. |
MC0013 | Internal consistency of compiler structures |
MC0014 | Internal consistency of compiler structures |