beautypg.com

How to use subroutines – IAI America ASEL User Manual

Page 304

background image

Part 2 Programs

Chapter 10 Example of Building a System

282

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