After much headscratching and wtf moments I am getting closer to the issue. But I cannot explain it, since CNC`ing is pretty new to me.
Every time a tool gets called up something happens to the coordinate system. Tool subprog is this:
O9000;
M09;
G91 G28 Z0;
T#149 M06;
M08;
M99;
%
If I dont call up a tool and run that sub everything is fine and works like a charm. Why is that?
Hello Kjeksen,
I believe the following will explain your issue.
Program O9000 is called via a “T” code by setting the TCS parameter bit to “1”. In this case, the M06 in your program O1035 is redundant. Accordingly omit the M06 in your Tool Call Block (T2 instead of T2 M06). The Tool Number to call in the Tool Change Macro is stored in Common Variable #149 when the program is called by a “T” Code.
When program O9000 is called, the Group 03 G Code(G90 - G91) will be set to G91 (Incremental) irrespective of what Group 03 G Code was Modal in your Main Program. Program O9000 as it stands will return control to the calling (Main) program with G91 as the Modal Group 03 G Code. Accordingly, when the following Block is executed:
G43 Z15. H02
it will be executed in Incremental Mode. In this case, if the Z axis is at the Reference Return Position (Machine Coordinate Z0.0), then the Z axis will go into Z+ over-travel immediately when G43 Z15. H02 is executed. Actually, I’m surprised that your not reporting an error in the X, Y positioning when G00 X292. Y-97.5 is executed after a Tool Change has been called, as this movement would also be in Incremental Mode.
The reason the problem doesn’t occur when a Tool is not called is that G90 is specified after the G28 G91 Z0 in your program, but does occur when a Tool is called because the G90 in your Main Program is specified before the Tool Call. To circumvent this problem, modify your Tool Change Program as shown in Red following
O9000;
#1 = #4003 (STORE THE CURRENT GROUP 03 G CODE)
M09;
G91 G28 Z0;
T#149 M06;
M08;
G#1 (RESTORE THE ORIGINAL GROUP 03 G CODE)
M99;
%
The above will ensure that the Group 03 G Code that was Modal before the Tool Change Call is restored before control is returned to the Main Program (Calling Program).
Regards,
Bill