Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 20

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

Number of steps
To call a function, the number of steps is required not only for the program itself but also for the processing that passes the
argument and return value and the processing that calls the program.
■ Program
The number of steps required for a function program is the total number of instruction steps plus 22 steps. For the number of
steps required for each instruction, refer to the following.
 MELSEC iQ-R Programming Manual (Instructions, Standard Functions/Function Blocks)
■ Calling source
When calling a function, the calling source generates the processing that passes the argument and return value before and
after the call processing.
Program block 1
(displayed)
M0
Y20
FUN1
D0
M10
FUN2
Y40
D10
The call-target program is
replaced with the call
instruction.
• 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.
Argument
Data type
class
VAR_INPUT
Bit
Word [unsigned]/bit string [16 bits]
Double word [unsigned]/bit string [32 bits]
Word [signed]
Double word [signed]
Single-precision real number
Double-precision real number
Time
String
String [Unicode]
Array, Structure
• Calling the program
A total of 26 steps are required to call the program of a function.
3 PROGRAM ORGANIZATION UNITS
18
3.2 Functions (FUN)
Program file
MOV D0 XX
M0
FUNCall FUN1
Y20
·
FB file
FUN1 program
Instruction used
LD+OUT
LD+MOVB
(Either of the instruction sets is used
depending on the combination of
programming language, function, and input
argument used.)
LD+MOV
LD+DMOV
LD+EMOV
LD+EDMOV
LD+DMOV
LD+$MOV
LD+$MOV_WS
LD+BMOV
(1) Passing the argument
(2) Calling the FUN1 program
(3) Passing the return value
(1)
(2)
(3)
Calling the function
Number of steps
For the number of steps required for
each instruction, refer to the following.
 MELSEC iQ-R Programming
Manual (Instructions, Standard
Functions/Function Blocks)

Advertisement

Table of Contents
loading

Table of Contents