34
Function Block Specifications
Section 2-1
Example
Like internal variables, the values of output variables are retained until the
next time the instance is executed (i.e., when EN turns OFF, the value of the
output variable is retained).
Example:
In the following example, the value of output variable CV will be retained until
the next time the instance is executed.
Note
1.
The same name cannot be assigned to an input variable and output vari-
able. If it is necessary to receive a value from an external variable, change
the variable inside the function block, and then return the result to the ex-
ternal variable, use an input-output variable.
2.
When the instance is executed, output variables are passed to the corre-
sponding parameters after the algorithm is processed. Consequently, val-
ues cannot be written from output variables to parameters within the
algorithm. If it is necessary to write a value within the execution cycle of the
algorithm, do not write the value to a parameter. Assign the value to an in-
ternal variable and use an AT setting (specified addresses).
Initial Value
An initial value can be set for an output variable that is not being retained, i.e.,
when the Retain Option is not selected. An initial value cannot be set for an
output variable if the Retain Option is selected.
The initial value will not be written to the output variable if the IOM Hold Bit
(A50012) is ON.
P_On
FB
EN ENO
PV CV
D0
D100
1.0
The value of the output variable (CV) is passed to the parameter
specified as the output destination, which is D100 in this case.
D1000
0.0
10.0
D200
ADD_INT_DINT
EN
ENO
IN16 OUT32
IN32
D100
tmp
DINT
EN
BOOL
IN16
INT
IN32
DINT
ENO
BOOL
OUT32
DINT
SIGN IN16 tmp
EN
+L IN32 tmp OUT32
OUT32 is a DINT variable, so
the variable's value is passed
to D1000 and D1001.
Algorithm (Body)
Variable table
Name
Internal
Input
Input
Input
Output
Output
Data type
Usage
CTD
CD Q
LD
PV CV
D150
Product A counter
Auxiliary Area control bit
Initial value
IOM Hold Bit (A50012)
ON
The initial value will not be set.
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......