6F3B0253
Basic Hardware and Function 97
6. Programming Information
6.6.5 Subroutines
In the program type ‘Subroutine’, The following number of subroutines can be
programmed.
The T1-16S supports up to 256 subroutines.
The subroutine is not a independent program. It is called from other program types
(main program, sub-program, interrupt program) and from other subroutines.
One subroutine is started with t h e SUBR instruction, and ended by the RET
instruction.
It is necessary to assign a subroutine number to the SUBR instruction. The available
subroutine numbers are 0 to 255.
[ SUBR (000) ]
Subroutine number
The RET instruction has no subroutine number.
The instruction that calls a registered subroutine is the CALL instruction. The CALL
instruction has the subroutine number to be called.
[ CALL N.000 ]
Subroutine number
Main program Subroutine
[ SUBR (000) ]
[ CALL N.000 ]
 [ RET ]
(1) Multiple subroutines can be programmed in a block. However, one
subroutine in one block is recommended.
(2) From the inside of a subroutine, other subroutines can be called
(nesting). Its allowable level is up to 3 levels.
NOTE
Execution
flow