469
7
7 Motion Control 7.3 Execution and Call of Motion Control Subprogram
2) Calling a motion control subprogram (an MC subprogram or a G-code subprogram)
General subprograms, encrypted subprograms, and parameter-carrying subprograms in H3U-PM are the
same, but have different attributes. Like the main program, motion control subprograms can be called. The
following table shows the call relationship between subprograms.
Callee
Caller
General subprogram
Encrypted subprogram
Parameter-carrying
subprogram
MC subprogram G-code subprogram
Main program (MAIN)
Called by the CALL
instruction
(Set by SD/SM) (Set by SD/SM)
General subprogram
Encrypted
subprogram
Parameter-carrying
subprogram
Called by the CALL
instruction
(Set by SD/SM) (Set by SD/SM)
MC subprogram ×
(Called by the MCALL
instruction)
(Called by the MCALL
instruction)
G-code subprogram × × (Called by M98)
Note: In the example where MAIN calls an MC subprogram, MAIN is the caller, and the MC subprogram is
the callee.
Up to 64 MC subprograms are supported and numbered from MC00 to MC63. Only one G-code
subprogram le numbered CNC00 (corresponding to MC10000) is supported. The G-code subprogram le
may have multiple Oxxxxs numbered from O0000 to O9999, which can be called as subprograms.
a) Nested layers of motion control subprograms
Up to six nested layers of motion control subprograms are supported. The rst layer is the motion control
subprogram called by a main program or a subprogram. Each time the motion control subprogram is called,
the number of nested layers is increased by 1. If the call of the nested layer is returned, the number of
nested layers is not increased, as shown in the following gure.
Subprograms of
the main program
Interrupt
subprogram
Housekeeping
Trigger and
enable the
motion control
subprogram
Motion
control
subprogram
Return after
execution
completed
Motion
control
subprogram
Motion
control
subprogram
Motion
control
subprogram
Motion
control
subprogram
1
Motion
control
subprogram
2 3 4 5 6