beckhoff TE1200 — 7 Pragmas and attributes

Pragmas and attributes The identifiers of INT variables must have a prefix "n" (naming convention NC0014), e.g. "nVar1". Function block names must start with "FB_" (naming convention NC0103), e.g. "FB_Sample". For the code shown below, the static analysis then only issues messages for the following variables: cVar, aVariable, bVariable. PROGRAM MAIN VAR {attribute 'naming' := 'off'} aVar : INT; bVar : INT; {attribute 'naming' := 'on'} cVar : INT; {attribute 'naming' := 'omit'} dVar : INT; fb1 : SampleFB; fb2 : FB; END_VAR {attribute 'naming' := 'omit'} FUNCTION_BLOCK SampleFB {attribute 'naming' := 'off'} FUNCTION_BLOCK FB VAR {attribute 'naming' := 'on'} aVariable : INT; bVariable : INT; …

Attribute {attribute 'nameprefix' := '...'} The attribute {attribute 'nameprefix' := '...'} defines a prefix for variables of a structured data type. A naming convention then applies to the effect that identifiers for instances of this type must have this prefix. Insertion location: above the declaration of a structured data type Syntax: {attribute ‘nameprefix’ := ' '} Example: The following naming conventions are defined in the category Naming conventions [ } 80] in the PLC project properties: Variables of the type of a structure (NC0032): st Structures (NC0151): ST_ Conversely, variables of the type "ST_Point" should not begin with the prefix "st", but with the prefix "pt".

In the following sample, the statistic analysis will output a message for "a1" and "st1" of the type "ST_Point" because the variable names do not begin with "pt". For variables of the type "ST_Test", conversely, the prefix "st" is expected. TYPE ST_Test : STRUCT … END_STRUCT END_TYPE {attribute 'nameprefix' := 'pt'} TYPE ST_Point : STRUCT x : INT; y : INT; END_STRUCT END_TYPE TE1200 124 Version: 2.11.1