Subroutine Instructions - Omron CPM1 - PROGRAMING MANUAL 02-2001 Programming Manual

Hide thumbs Also See for CPM1 - PROGRAMING MANUAL 02-2001:
Table of Contents

Advertisement

Subroutine Instructions

7-26 Subroutine Instructions
7-26-1 SUBROUTINE ENTER – SBS(91)
Limitations
Description
484
Subroutines break large control tasks into smaller ones and enable you to reuse
a given set of instructions. When the main program calls a subroutine, control is
transferred to the subroutine and the subroutine instructions are executed. The
instructions within a subroutine are written in the same way as main program
code. When all the subroutine instructions have been executed, control returns
to the main program to the point just after the point from which the subroutine
was entered (unless otherwise specified in the subroutine).
Ladder Symbol
SBS(91) N
The subroutine number must be between 000 and 049.
A subroutine can be executed by placing SBS(91) in the main program at the
point where the subroutine is desired. The subroutine number used in SBS(91)
indicates the desired subroutine. When SBS(91) is executed (i.e., when the
execution condition for it is ON), the instructions between the SBN(92) with the
same subroutine number and the first RET(93) after it are executed before
execution returns to the instruction following the SBS(91) that made the call.
SBS(91) may be used as many times as desired in the program, i.e., the same
subroutine may be called from different places in the program).
Definer Data Areas
N: Subroutine number
000 to 049
Main program
SBS(91)
000
Main program
SBN(92)
000
Subroutine
RET(93)
END(01)
Section
7-26

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents