5. CONFIGURATION
5.1.1.2. Retain and Persistent Memory Areas
The Nexto CPU allows the use of symbolic variables and output variables of direct representation as retentive or persistent
variables.
The output variables of direct representation which will be retentive or persistent must be declared in the CPU General
Parameters, as described at CPU Configuration. Symbolic names also can be attributed to these output variables of direct
representation using the AT directive, plus using the key word RETAIN or PERSISTENT on its declaration. For example,
being %QB4096 and %QB20480 within the retentive and persistent memory, respectively:
PROGRAM UserPrg
VAR RETAIN
byRetentiveVariable_01 AT %QB4096 : BYTE;
END_VAR
VAR PERSISTENT
byPersistentVariable_01 AT %QB20480 : BYTE;
END_VAR
In case the symbolic variables declared with the AT directive are not inside the respective retentive and/or persistent
memory, errors during the code generation in MasterTool can be presented (as described at General Parameters, configuration
Consist retain and persistent area in %Q), informing that there are non-retentive or non-persistent variables defined in the
retentive or persistent memory spaces.
Regarding the symbolic variables which will be retentive or persistent, only the retentive variables may be local or global,
as the persistent symbolic variables shall always be global. For the declaration of retentive symbolic variables, it must be used
the key word RETAIN. For example, for local variables:
PROGRAM UserPrg
VAR RETAIN
wLocalSymbolicRetentiveVariable_01 : WORD;
END_VAR
Or, for global variables, declared within a list of global variables:
VAR_GLOBAL RETAIN
wGlobalSymbolicRetentiveVariable_01 : WORD;
END_VAR
On the other hand, the persistent symbolic variables shall be declared in a Persistent Variables object, being added to the
application. These variables will be global and will be declared in the following way within the object:
VAR_GLOBAL PERSISTENT RETAIN
wGlobalSymbolicPersistentVariable_01 : WORD;
END_VAR
As of versions 1.5.1.1 the Nexto Series CPUs allow flexibility on the usage of retentive and persistent memories. This
means that the user will be able to choose the size that will be used for each type of memory, as long as the retentive and
persistent memory sum don’t exceed the total limit available in each CPU model. The total of retentive and persistent memory
available is described in the Table 6 in Memory.
If the retentive symbolic, persistent symbolic, retentive %Q and persistent %Q memory sum exceed the total available,
MasterTool will show an error during the code generation.
65