6F3B0253

6. Programming Information

6.6.5Subroutines

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 the 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

 [ CALL N.000 ]

Execution

flow

Subroutine

 [ SUBR (000) ]



[ RET ]

NOTE

(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.

Basic Hardware and Function 97

Page 99
Image 99
Toshiba 6F3B0253 user manual Subroutines