Справочник Пользователя для Mitsubishi Electronics FX5

Скачать
Страница из 306
1  PROGRAM EXECUTION
1.5  Program Type
29
1
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 programs can also be managed as separate programs by turning them into standby type 
 • 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.
RET
END
P1
RET
Y12
RET
Y11
P8
P0
FEND
Y10
Subroutine program 1
Subroutine program 2
Subroutine program 3
Pointer
Main routine program