beautypg.com

Instructions fun 128 call subroutine call – Toshiba 6F3B0253 User Manual

Page 205

background image

6F3B0253

Basic Hardware and Function

203

7. Instructions

FUN 128

CALL

Subroutine call

Expression

Input

[ CALL N. n ]

Output

Function

When the input is ON, this instruction calls the subroutine number n.

Execution condition

Input

Operation

Output

OFF

No execution

OFF

ON

Execution

ON

Operand

Name

Device

Register

Constant Index

X

Y

R

S

T.

C. XW YW RW SW T

C

D

I

J

K

n Subroutine

number

(Note)

Example

When X007 is ON, the subroutine number 8 is called. When the program execution is returned
from the subroutine, the output is turned ON.

Main program

Subroutine

| | [ CALL N.008 ]

[ SUBR (008)]

[ RET ]

Note

The possible subroutine number is 0 to 15 (T1) or 0 to 255 (T1S).

Refer to the SUBR instruction (FUN 137).

In case of T1, nesting of subroutines is not allowed. That is, the CALL instruction cannot be

used in a subroutine.

In case of T1S, nesting of subroutines is possible. (up to 3 levels)

The CALL instruction can be used in an interrupt program. However, it is not allowed that the

same subroutine is called from an interrupt program and from main program.