36
Function Block Specifications
Section 2-1
Retain Data through Power Interruptions and Start of Operation
Internal variables retain the value from the last time that the instance was
called. In addition, the Retain Option can be selected so that an internal vari-
able will also retains its value when the power is interrupted or operation
starts (the mode is switched from PROGRAM to RUN or MONITOR mode).
When the Retain Option is selected, the value of the variable is retained when
the power is interrupted or operation starts unless the CPU Unit does not
have a backup battery. If the CPU Unit does not have a good battery, the value
will be unstable.
When the Retain Option is not selected, the value of the variable will not be
held when the power is interrupted or operation starts. Even variables not set
to be retained, however, can be held at the start of operation by turning ON
the IOM Hold Bit (A50012) and can be held during power interruptions by set-
ting the PLC Setup, as shown in the following table.
Note The IOM Hold Bit (A50012) is supported for compatibility with previous mod-
els. To hold the values of variables in function blocks, however, use the Retain
Option and not the IOM Hold Bit.
Initial Value
An initial value can be set for an internal variable that is not being retained
(i.e., when the Retain Option not selected). An initial value cannot be set for
an internal variable if the Retain Option is selected.
Internal variables that are not being retained will be initialized to 0.
The initial value will not be written to the internal variable if the IOM Hold Bit
(A50012) is ON
.
Variables Condition Status
Variables set to Retain Start of operation Retained
Power ON Retained
SIGN IN16 tmp
EN
+L IN32 tmp OUT32
tmp DINT
EN BOOL
IN16 INT
IN32 DINT
ENO BOOL
OUT32 DINT
D1000
0.0
10.0
D200
ADD_INT_DINT
EN ENO
IN16 OUT32
IN32
D100
Internal variable tmp
is not displayed.
Algorithm (Body)
Variable table
Name
Internal
Input
Input
Input
Output
Output
Type
Variables Condition IOM Hold Bit (A50012) setting
OFF ON
IOM Hold Bit Status at Startup
(PLC Setup) selected
IOM Hold Bit Status at Startup
(PLC Setup) not selected
Variables not
set to Retain
Start of operation Not retained Retained Retained
Power ON Not retained Retained Not retained
Auxiliary Area control bit Initial value
IOM Hold Bit (A50012) ON The initial value will not be set.
OFF The initial value will be set.