20
3 PROGRAM ORGANIZATION UNIT (POU)
3.2 Function Block (FB)
■Program
The number of steps required for a function block program is the total number of instruction steps, like normal programs.
For the number of steps required for each instruction, refer to the following.
Programming manual (Instructions, Standard Functions/Function Blockls)
Subroutine type function blocks
■Calling source
When calling a subroutine type function block, the calling source generates the processing that passes the argument and
return value before and after the call processing.
Passing the argument
The instruction used to pass the argument differs depending on the class and data type of the argument. The following table
summarizes the instructions that can be used to pass the argument.
Calling the program
A total of 12 steps are required to call the function block program.
Passing the return value
The instruction used to pass the return value differs depending on the class and data type of the argument. The following table
summarizes the instructions that can be used to pass the return value.
(1) Passing the argument
(2) Calling the FB1 program
(3) Passing the return value
Argument class Data type Instruction used Number of steps
VAR_INPUT
VAR_IN_OUT
Bit LD+OUT
LD+MOVB
(Which of the above instructions to use is
determined by the combination of the
programming language, type of function, and
type of input argument.)
For the number of steps required for
each instruction, refer to the
following.
Programming manual
(Instructions, Standard Functions/
Function Blocks)
Word [Unsigned]/Bit String [16-bit]
Double Word [Unsigned]/Bit String [32-bit]
Word [Signed]
Double Word [Signed]
LD+MOV
LD+DMOV
FLOAT [Single Precision] LD+EMOV
Time LD+DMOV
String(32) LD+$MOV
Array, Structure LD+BMOV
Argument class Data type Instruction used Number of steps
VAR_OUTPUT
VAR_IN_OUT
Same as for passing the argument. Same as for passing the argument. Same as for passing the argument.
FB1
FB1_a
FB1
FB1_b
M0
M0
MOV D0 XX
(1)
(2)
(3)
FBCall FB1_a
Y20
…
Y20
D0
M10 Y40
D10
Program block 1
(displayed)
Program file
FB file
FB1 program
The call-target program
is replaced with the call
instruction.
Calling the
function block