Chapter
11
111
Jump Instructions and
Subroutine Programming
The Jump instruction and subroutine programming allow programming
flexibility and efficiency. Four instructions are used to implement program
jumps and subroutines:
Jump – JMP
Label – LBL
Jump to Subroutine – JSR
Return – RET
The Jump and Label instructions allow portions of a program to be
selectively jumped over in order to reduce scan time. When more than
one program section each controls a separate process or operation, these
instructions allow the required program to be executed as needed.
The Jump to Subroutine, Label and Return instructions are used together
to access reserved sections of program called subroutines. A subroutine
can be called upon repeatedly from selected points in the main program.
Subroutines can be used to conserve memory in applications where
repetitive programming is required or when sections of program do not
need to be executed each scan.
This section will describe how Jump instructions and subroutine
programming are used and how they direct the path of the program scan
through the main program and the subroutine area.
The Jump instruction shown in Figure 11.1 is an output instruction. It has
an identification number from 00-77. When its rung is true, it instructs the
processor to jump forward in the main program to the Label instruction
having the same identification number (Figure 11.2). The main program is
then executed from that point.
11.0
General
11.1
Jump Instruction
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com