
Drive PLC Developer Studio
Editors
7-13
l DDS EN 2.3
Application example
An operating hour meter that is to continue counting after a mains failure.
• All other variables will be re-initialized either with the standard initial values (0 or FALSE) or
with the defined initial values.
Example:
VAR RETAIN
rem1:INT; (* 1. retentive variable *)
END_VAR
7.2.7 Constants, typed literals
Between the keywords VAR CONSTANT and END_VAR, all constants are declared.
• Constants can be declared locally or globally.
Syntax:
VAR CONSTANT
<Identifier>:<Type> := <Initialization>;
END_VAR
Example:
VAR CONSTANT
con1:INT:=12; (* 1. constant *)
END_VAR
For a list of permitted constants refer chapter on Operands.
(^ 13-1)
7.2.8 Retentive constants
Between the keywords VAR CONSTANT RETAIN and END_VAR, all retentive constants are
declared.
• Retentive constants can be declared locally or globally.
Syntax:
VAR CONSTANT RETAIN
<Identifier>:<Type> := <Initialization>;
END_VAR
Example:
VAR CONSTANT RETAIN
Acceleration: DINT:=10000; (* acceleration time *)
END_VAR
7.2.9 Keywords
• Alleditorsrequirekeywordstobewrittenincapitals.
• Keywords must not be used as variable names.
Comentários a estes Manuais