I have a problem with the g20/g21 and g70/71 codes. Whenever I use any of these in a program I get unpredictable results.
I use the following short programs to illustrate the problem. I move my z axis to the top of my table, and move the x
and y to a convenient place on the table. I the zero all three DRO's and run program test1. The results are that the three axis
each moved the predicted one inch.
(test1)
g0 f30
g1 x1 y1 z1 (move to x=1, y=1 z=1)
m1 (stop, read DRO's first time - cycle start to continue) (DRO's read x=1 y=1 z=1)
x0 y0 z0 (move back to orgin)
m30
Next I edit the g code (using Mach 3) to add a g 20 and regenerate the path
resulting in the following code.
(test 2)
g0 f30 g20
g1 x1 y1 z1 (move to x=1, y=1 z=1)
m1 (stop, read DRO's - cycle start to continue) (DRO's read x=1 y=1 z=1)
x0 y0 z0 (move back to orgin)
m30
As soon as I put the g20 into the code my DRO's changed from 0 to
x =-16.7674
y = -388.7217
z = -53.7139
Since the position was previously at 0,0,0 I zero all three axis to read 0's and regenerate the path.
I start the code and the machine immediately moves to the y and z stops and tries to keep going until
I stop it manually (using escape).
If I remove the g20 the axis are still screwed up when I run the program.
If I replace the g20 with a g 21 then everthing goes back to normal in terms of movement,
i.e. the 3 axis move one inch
when the program runs, however the speed of movement appears to be much slower than normal for f30.
Closing Mach3 and and loading a program without a g20 seems to make things normal again.
If I close mach3 and reload the program with the g21 in the movement seems to be OK but
the speed of movement is still slower, i.e. the movement at f30 is not as fast as normal.
If I reload the program with a g70 in place of the g20 it behaves as if I used g20, i.e. g20 and g70 behave the same.
If I use g71 instead of g21 I get the same results except the speed of movement seems normal for f30.
Since I never use mm it does not seem to be a problem if I simply leave the g20 out, however
I like to keep my code portable which dictates that you not assume any previous machine conditions.
Any suggestions?