Local variables, Remanent variables, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 258

Advertising
background image

L-force | PLC Designer

Editors in PLC Designer

256

DMS 3.2 EN 02/2011 TD29



7.2.7

Local Variables

Between the keywords VAR and END_VAR, all of the local variables of a POU are
declared. These have no external connection; in other words, they can not be written
from the outside.

Example:

VAR

iLoc1:INT; (* 1. Local Variable*)

END_VAR

7.2.8

Remanent variables

Remanent variables can retain their value throughout the usual program run period.
These include Retain variables and Persistent variables.

Example:

VAR RETAIN

iRem1:INT; (* 1. Retain variable*)

END_VAR

Retain variables are identified by the keyword RETAIN. These variables maintain their
value even after an uncontrolled shutdown of the controller as well as after a normal
switch off and on of the controller (corresponding to command 'Online' 'Reset'). When
the program is run again, the stored values will be processed further. A concrete

example would be an piece-counter in a production line, that recommences counting
after a power failure. All other variables are newly initialized, either with their
initialized values or with the standard initializations.
Retains are reinitialized at 'Reset (cold)' and 'Reset (original)' and - contrary to
Persistent variables - at a new download of the program.
Persistent variables are identified by the keyword PERSISTENT. Unlike Retain variables,
these variables retain their value only after a re-Download, but not after an 'Online'
'Reset', 'Online' 'Reset (original)' or 'Online' 'Reset (cold)', because they are not saved in
the "retain area". If also persistent variables should maintain their values after a
uncontrolled shutdown of the controller, then they have to be declared additionally as
VAR RETAIN variables. A concrete example of "persistent Retain-Variables" would be a
operations timer that recommences timing after a power failure.

Advertising