Configuration | Rules 4.2.1.1.6 SA0006: Write access from several tasks | SA0006: Write access from several tasks See also rule SA0103: Concurrent access on not atomic data [ } 58] . Call corresponds to write access Please note that calls are interpreted as write access. For example, calling a method for a function block instance is regarded as a write access to the function block instance. A more accurate analysis of accesses and calls is not possible, e.g. due to virtual calls (pointers, interface). To deactivate rule SA0006 for a variable (e.g. for a function block instance), the following attribute can be inserted above the variable declaration: {attribute 'analysis' := '-6'} Samples:
The two global variables nVar and bVar are written by two tasks. Global variable list: VAR_GLOBAL nVar : INT; bVar : BOOL; END_VAR Program MAIN_Fast, called from the task PlcTaskFast: nVar := nVar + 1; // => SA0006 bVar := (nVar > 10); // => SA0006 Program MAIN_Slow, called from the task PlcTaskSlow: nVar := nVar + 2; // => SA0006 bVar := (nVar SA0006 4.2.1.1.7 SA0007: Address operators on constants | SA0007: Address operators on constants If the option Replace constants is enabled in the compiler options of the PLC project properties, the address operator for scalar constants (Integer, BOOL, REAL) is not allowed and a compilation error is issued.
(Constant strings, structures and arrays always have an address.) Sample: TE1200 23 Version: 2.11.1 Function Determines variables with write access from more than one task. Reason A variable that is written in several tasks may change its value unexpectedly under certain circumstances. This can lead to confusing situations. String variables and, on some 32-bit systems, 64-bit integer variables also may even assume an inconsistent state if the variable is written in two tasks at the same time. Exception In certain cases it may be necessary for several tasks to write a variable. Make sure, for example through the use of semaphores, that the access does not lead to an inconsistent state.
Importance High PLCopen rule CP10 Function Determines locations at which the ADR operator is used for a constant. Reason A pointer to a constant variable cancels the CONSTANT property of the variable. The variable can be changed via the pointer without the compiler reporting this. Exception In rare cases, it may make sense for pointer to a constant to be passed to a function. If this option is used, measures must be implemented to ensure that the function does not change the value that was passed to it. In this case, use VAR IN OUT CONSTANT if _ _ possible. Importance High