Home › G-codes › Siemens 840D 828D › GOTOF
GOTOF Jump forward or back to a label
Siemens 840D 828D G-code · Mill and lathe
GOTOF jumps forward to a label, GOTOB jumps back. With IF it becomes a conditional jump for loops and checks.
Format
GOTOF LABEL or GOTOB LABEL or IF condition GOTOF LABEL
Addresses
| Address | What it does |
|---|---|
LABEL | Jump destination, set as LABEL: in front of a block |
How it works
Non modal.
Example program
R1=0 ; COUNTER
LOOP: G91 G0 X10 ; STEP
R1=R1+1
IF R1<5 GOTOB LOOP ; REPEAT 5 TIMES
…
LOOP: G91 G0 X10 ; STEP
R1=R1+1
IF R1<5 GOTOB LOOP ; REPEAT 5 TIMES
…
The full 6-line example is in the app. Example is in inch. Check offsets and clearances first.
Watch out for
- GOTOF only searches forward and GOTOB only backward. The wrong one gives a label not found alarm.
- Make sure a loop changes the variable it tests, or it never ends.
Related codes
Every G-code for Siemens 840D 828D in your pocket. The app has the full example programs, search by number or shop word, a line decoder and calculators for tapping, threading and drilling.
Open GOTOF in the app All Siemens 840D 828D G-codes