Program Type; Subroutine Program - Mitsubishi Electric FX5 User Manual

Melsec iq-f series
Hide thumbs Also See for FX5:
Table of Contents

Advertisement

1.5

Program Type

Programs that use pointers (P) or interrupt pointers (I) are explained below.

Subroutine program

This is the program from pointer (P) up to the RET instruction. Subroutine programs are executed only when they are called
by the CALL instruction. Pointer type labels also can be used instead of pointers (P). The applications of subroutine programs
are as follows:
• By grouping programs that are executed multiple times in one scan into a single subroutine program, the number of steps
in the entire program can be reduced.
• A program that is executed only under certain conditions can be saved as a subroutine program which shortens the scan
time proportionately.
Subroutine program 1
Subroutine program 2
Subroutine program 3
• Subroutine programs can also be managed as separate programs by turning them into standby type
programs. (Page 31 Stand-by type program)
• Pointers need not be programmed starting with the smallest number.
Precautions
The precautions when using subroutine programs are explained below.
• Do not use timers (T, ST). Note, however, that timers can be used when a timer coil (OUT T instruction) is always
executed only once in one scan.
• An error occurs when program execution returns to the call source program and the program is terminated without using
the RET instruction.
• An error occurs when there is no pointer (P) or pointer type global label in FB or FUN.
1 PROGRAM EXECUTION
32
1.5 Program Type
Main routine program
FEND
P0
Y10
RET
P8
Y11
RET
P1
Y12
RET
END
Pointer

Advertisement

Table of Contents
loading

Table of Contents