Okuma OSP-P200L Programming Manual page 288

Hide thumbs Also See for OSP-P200L:
Table of Contents

Advertisement

When using local variables in a called subprogram, and there are several local variables with
the same name registered in the memory, the data of the local variable which last had that
name registered is used. The local variables set in the block containing the CALL statement
are all cleared when the RTS statement in the called subprogram is executed.
Main Program
ABC=20 DEF=50
N100 CALL O1000
&ABC=100 DEF=150
N101
1
In the example above, execution of N2010 in subprogram 2 registers 4 kinds of local variables
with the same name - ABC and DEF - then subprogram O3000 is executed. If subprogram
O3000 contains local variable names ABC and DEF, the numeric data registered last, i.e., ABC
= 400 and DEF = 350 are called for. At the end of subprogram O3000, that is, when the RTS
statement in 03000 is executed, the local variables registered by the subprogram CALL O3000,
ABC = 400 and DEF = 350, are cleared from the memory.
Subprogram 1
O1000
N1050 CALL O2000
N2010 CALL O3000
&ABC=500 DEF=750
&ABC=400 DEF=350
N1051
N2011
N1100 RTS
2
Registration of Local Variables
ABC
Main Program
DEF
ABC
Subprogram 1
DEF
ABC
Subprogram 2
DEF
ABC
Subprogram 3
DEF
Subprogram 2
Subprogram 3
O2000
O3000
RTS
RTS
3
20
50
100
150
Cleared in
500
750
Cleared in
400
350
Cleared in
5238-E P-275
SECTION 12 USER TASK
1
2
3
LE33013R0301400120003

Advertisement

Table of Contents
loading

This manual is also suitable for:

Osp-p20l-rOsp-p20lOsp-p200l-r

Table of Contents