6F3B0250

6. Programming Information

6.6.5Subroutines

In the program type ‘Subroutine’, The following number of subroutines can be programmed.

T1

T1S

Up to 16 subroutines

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 (T1S only).

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 15 for the T1, or 0 to 255 for the T1S.

¾[ 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) ]¾¾¾ç

NOTE

ú¾¾¾¾¾¾ [ RET ]¾ç

(1) Multiple subroutines can be programmed in a block. However, one subroutine in one block is recommended.

(2) In case of the T1S, other subroutines can be called from a subroutine (nesting), up to 3 levels. In the T1, nesting is not allowed.

Basic Hardware and Function 115

CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: info@ctiautomation.net

Page 117
Image 117
Toshiba 6F3B0250, PROSEC T1 T1S user manual Subroutines