6F3B0250
Basic Hardware and Function 115
6. Programming Information

6.6.5 Subroutines

In the program type ‘Subroutine’, The f ollowing 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
progr am , sub- program, int errupt prog r am ) and from ot her subroutines (T 1S only).
One subroutine is st arted 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 number s ar e 0 to 15 for t he T1, or 0 to 255 for the T 1S.
¾[ SUBR (000) ] ¾
Subroutine number
The RET instruction has no subroutine number.
The instr uct ion that calls a regist er ed subr out ine is the CALL instruction. The CALL
instruction has t he subroutine number to be called.
¾[ CALL N.000 ] ¾
Subroutine number
Main program Subroutine
ú¾[ SUBR (000) ] ¾¾¾ç
ú¾çú¾[ CALL N.000 ] ¾¾ç
ú¾¾¾¾¾¾ [ RET ]¾ç
NOTE (1) Multiple subroutines can be progr am m ed in a block. However, one
subroutine in one block is r ecommended.
(2) I n case of the T1S, other subroutines can be called from a subr out ine
(nesting) , up to 3 levels. In the T 1, nesting is not allowed.
Execution
flow
CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: info@ctiautomation.net