Siemens CNC | RET Code | Subprogram Return Jump

In this article, we describe how to use RET code for subprogram return jump in Siemens CNC controlled machines with all details and examples.

0
278

RET Code Introduction

In the Siemens shell cycles for stock removal (as in ISO Dialect), it is necessary after roughing to resume program execution in the main program after the contour definition. To achieve this, the shell cycle must contain a subprogram return jump to the block after the end of the contour definition. The RET code used for it.

The RET command has been extended with two optional parameters for skipping the blocks with the contour definition in the stock removal cycles after the subprogram call (with G71–G73).

The command RET (STRING: <sequence no./label>) is used to resume program execution in the calling program (main program) at the block with <sequence no./ label>.

If program execution is to be resumed at the next block after <sequence no./label>, the 2nd parameter in the RET command must be > 0; RET (<sequence no./label>, 1). If a value > 1 is programmed for the 2nd parameter, the subprogram also jumps back to the block after the block with <sequence no./label>.

In G70–G73 cycles, the contour to be machined is stored in the main program. The extended RET command is required in order to resume execution after the contour definition in the main program at the end of G70 (finish cut via contour with stock removal cycle). To jump to the next NC block after the contour definition at the end of the shell cycle for G70, the shell cycle must be terminated with the following return syntax:

You may be interested also:
“Siemens CNC Milling | ROT and AROT | Programmable Rotation”

RET Code Format

RET (’N’ << $C_Q, 1)

Search Direction

The search direction for <sequence no./label> is always forwards first (towards the end of the program) and then backwards (towards the head of program).

RET Command Example

N10 X10. Y20.
N20 G71 P30 Q60 U1 W1 F1000 S1500
N10 … ;Shell cycle for stock removal cycle
N20 DEF STRING[6]BACK
N30 …
N90
N100 RET (’N’<<$C_Q, 1) ; Return jump to block after Contour def. -> N70
N30 X50. Z20.
N40 X60.
N50 Z55.
N60 X100. Z70.
N70 G70 P30 Q60
N80 G0 X150. Z200.
N90 M30

Note: M30 in Siemens mode: is interpreted as a return jump in a subprogram. M30 in ISO Dialect mode: is also interpreted as the end of the part program in a subprogram.


Need to More?

Our volunteers have worked together and carefully prepared the articles published here in their native language without using machine translation. You can search the entire site for more information on the subject. You can start a discussion on CNCarea.com forums and join us to get support, ask questions, improve a published article or give your opinion.


Previous articleCNC | G98 and G99 Code | Return Point Level
Next articleCNC Lathe | G50.2 and G51.2 | Polygon Turning