Hello,
I'm currently trying to program my fixed-position toolchanger with a remap of the M6 Tx command. I have 3 o-codes for better readability. The first one checks which state the machine is in and acts accordingly. The second and third ones store the coordinates for the different slots of the current and called tool (I didn't find a more elegant way to do this, maybe someone has a suggestion there) and store or catch the tool. The file "toolchange" seems to work fine, but when it gets to the o-code "wkz_holen" (german for getting the tool) it gets caught up in a loop:
It first goes to o500 in "toolchange", moves to X20 Y300 Z300, then proceeds to o501 and since the current tool is T0, calls "wkz_holen". There it executes the lines to get the called tool and jumps back to the position X20 Y300 Z300 in the file "toolchange" and begins the same cycle. Can someone explain why it does that? I don't work with return or while so I can't see, why it jumps back instead of proceeding forward.
The code I used: