Home › G-codes › Siemens 808D › GOTOF
GOTOF Jump forward or back to a label
Siemens 808D G-code · Mill and lathe
GOTOF jumps forward toward the program end, GOTOB back toward the start. IF in front makes it a conditional jump. The target is a label or block number in the same program.
Format
GOTOF LABEL or GOTOB LABEL or IF condition GOTOF LABEL
Addresses
| Address | What it does |
|---|---|
LABEL | Jump target, set with a colon at the start of the block, as LABEL1: |
condition | Comparison such as R1>5, R1==2 or R1<>0 |
How it works
Non modal. The jump needs a block of its own.
Example program
R1=0 ; COUNTER
MC1: G91 G0 X10 ; STEP 10 IN X
R1=R1+1 ; COUNT UP
IF R1<5 GOTOB MC1 ; REPEAT UNTIL 5 STEPS
…
MC1: G91 G0 X10 ; STEP 10 IN X
R1=R1+1 ; COUNT UP
IF R1<5 GOTOB MC1 ; REPEAT UNTIL 5 STEPS
…
The full 8-line example is in the app. Example is in inch. Check offsets and clearances first.
Watch out for
- Labels have 2 to 8 characters, start with two letters or underscores, and must be unique in the program.
- Several IF jumps can share a block. The first condition that is true makes the jump.
- Make sure a loop changes the value it tests, or it never ends.
Related codes
GOTOF on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Siemens 840D 828D | Jump forward or back to a label |
Every G-code for Siemens 808D 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 808D G-codes