Call the Sub Routine Program

Sub Routine Instruction: CALL, CALLP, SBRT, RET

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

Error

Zero

Carry

CALL (P)

n

-

-

-

-

-

-

-

-

-

-

-

-

o

1

-

-

-

SBRT

n

-

-

-

-

-

-

-

-

-

-

-

-

o

1

-

-

-

RET

-

-

-

-

-

-

-

-

-

-

-

-

-

-

1

-

-

-

 

 

Functions

  • When the input condition for the CALL n instruction is turned ON, a program executes the called operations between the SBRT n and the RET according to the CALL n

CALL No. can be used by nesting.

The instructions between the SBRT n and the RET must be located after the END instruction.

 

Conditions processed as an error:

When a value of n is entered other than 0 ~ 127.

When the CALL n instruction exists without the SBRT n.

When the SBRT n or the RET stands alone.

 

It is possible to CALL another SBRT within a SBRT up to maximum of 16 times.

 

 

Example)

When the input condition (M04) for the CALL 3 is turned ON, the program executes the called operations (F92 -> INCP D0 / F10 -> MOV D0 M60) between the SBRT 3 and the RET according to the CALL 3 instruction.

 

As the clock ticks every 0.2 seconds (F92), it will increase the value of D0 by 1.

As F10 is always ON, it will move the value of D0 to the device M60.