5238-E P-289
SECTION 12 USER TASK
Example 2: Main Program
LE33013R0301400320003
When block N1000 in the main program is executed, sequence execution jumps to subprogram
O1234.
The subprogram is executed from N001 and when the control reads the RTS
statement in N050,
sequence execution then jumps back to N1001 of the main program and the commands in that block
and subsequent blocks are executed. At the same time as the jump from the subprogram to the
main program occurs, variables XP1 and ZP1 are cleared.
Order of program execution:
LE33013R0301400320004
4-1-3. MODIN Statement
[Program Format]
LE33013R0301400330001
[Function]
The designated subprogram is called each time an axis motion command is executed. That is, the
designated subprogram is called and executed each time an axis motion command (*1) in the
program calling that subprogram is executed. This function remains active until the MODOUT
statement described in (4) is read.
*1 Axis motion command means any command in G00, G01, G03 and G31 through G35 mode
which contains either an or X and Z word or both.
N1000
N1001
:
:
CALL O1234 XP1 = 150 ZP1 = 10
Subprogram
O1234
N001
:
:
N050
G00
:
:
RTS
XZ
N1000 O1234 N001 N050 N1001 ⋅⋅⋅
N0 MODIN O1 Q1 <Variable setting section>
Sequence name of this block (can be omitted)
Designates a MODIN statement
Program name of the subprogram to be called. Mandatory.
Indicates the number of repetitions of the subprogram to be called
(1 to 9999 following address character Q; assumed to be Q1 if not
specified)
Set the variables to be used in the called subprogram.