beautypg.com

How to use subroutines – IAI America PSEL User Manual

Page 298

background image




288

Part 2 Programs

14. How to Use Subroutines


Description


A subroutine is a group of steps that are called and executed several times within a program. Subroutines
are used to reduce the number of program steps and make the program easy to read. Up to 99
subroutines can be used in one program. Up to 15 subroutine calls can be nested.

How to Use


Declare/call subroutines using the following commands:
EXSR:

Call a subroutine

BGSR: Declare the start of a subroutine (start of a group of steps)
EDSR: Declare the end of a subroutine (end of a group of steps)

Example of Use


























Caution


Jumping from within a subroutine to a TAG position outside the subroutine using a GOTO command is
prohibited.

The same tasks are consolidated
into a single location.

Subroutine