M6 Tx Remap with O-Code

More
07 Dec 2022 08:12 - 07 Dec 2022 08:18 #258793 by markkram
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:
Warning: Spoiler!
Last edit: 07 Dec 2022 08:18 by markkram.

Please Log in or Create an account to join the conversation.

More
07 Dec 2022 15:33 #258814 by MaHa
Replied by MaHa on topic M6 Tx Remap with O-Code
After toolchange it is still in the o501 conditional, checking for selected tool, which is -1 after toolchange.

Please Log in or Create an account to join the conversation.

More
07 Dec 2022 18:58 #258825 by markkram
Replied by markkram on topic M6 Tx Remap with O-Code
so the parameter #<_selected_tool> switches to -1 after the toolchange? How do I get out of the loop of doom then?

Please Log in or Create an account to join the conversation.

More
07 Dec 2022 22:00 #258838 by MaHa
Replied by MaHa on topic M6 Tx Remap with O-Code
You can try if that helps, insert o-return after 'o100 endif' to leave the toolchange sub.
o100 endif

o500 return

o<sub_progs/wkz_holen> endsub

Please Log in or Create an account to join the conversation.

More
08 Dec 2022 19:01 #258908 by markkram
Replied by markkram on topic M6 Tx Remap with O-Code
The error was caused by something different I think. The command M6 G43 in the o501 subroutine executed the whole toolchange.ngc again due to the remap, because M6 now calls the toolchange.ngc
I changed this line to G43 alone and added a M61 command. The final and working code is below if anybody wants to use it.
Warning: Spoiler!

Please Log in or Create an account to join the conversation.

Time to create page: 0.191 seconds
Powered by Kunena Forum