Attribute const_replaced, Attribute const_non_replaced

Überblick

Fügen Sie das pragma {attribute 'const_replaced'} in der Deklaration einer globalen Konstante vom Typ Skalar ein, wenn Sie die Compiler-Option Konstanten ersetzen für diese Konstante explizit aktivieren möchten. Dadurch wird die Konstante in der Symbolkonfiguration verfügbar.

HINWEIS: Das Pragma wirkt sich nicht auf Variablen von zusammengesetzten Typen wie Arrays und Strukturen aus.

Entsprechend können Sie das Pragma {attribute 'const_non_replaced'} einfügen, um die Compiler-Option Konstanten ersetzen zu deaktivieren.

Die Option Konstanten ersetzen ist für das gesamte Projekt im Dialogfeld Projekteinstellungen > Compiler-Optionen SoMMenu/index.htm vordefiniert.

Syntax

{attribute 'const_replaced'}
{attribute 'const_non_replaced'}

Beispiel

Die Konstanten iTestCon und bTestCon sind in der Symbolkonfiguration verfügbar, weil Konstanten ersetzen durch Pragmas deaktiviert wird.

VAR_GLOBAL CONSTANT
    {attribute 'const_non_replaced'}
    iTestCon    :    INT  := 12;    
    {attribute 'const_non_replaced'}
    bTestCon    :    BOOL := TRUE;
    rTestCon    :    REAL := 1.5;
END_VAR
VAR_GLOBAL
    iTestVar    :    INT  := 12;    
    bTestVar    :    BOOL := TRUE;
END_VAR