Hello Guest it is September 21, 2019, 08:33:03 PM

Author Topic: g20/g21 and g70/g71 problems  (Read 6871 times)

0 Members and 1 Guest are viewing this topic.

g20/g21 and g70/g71 problems
« on: March 03, 2011, 04:25:12 PM »
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?


Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: g20/g21 and g70/g71 problems
« Reply #1 on: March 03, 2011, 04:42:35 PM »
Can you attach your xml please.
Hood
Re: g20/g21 and g70/g71 problems
« Reply #2 on: March 04, 2011, 01:03:32 PM »
I thought that I sent the XML code yesterday, but I must have messed up the post somehow.  Here it is.

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: g20/g21 and g70/g71 problems
« Reply #3 on: March 04, 2011, 01:23:30 PM »
Ok you are set up as mm for native units and I am thinking you are meant to be inches?
If thats the case then go to Config then SetNative Units and then change that to Inch. Next you will have to go to motor tuning and multiply each of your X Y and Z axis steps per unit by 25.4, remember to save axis settings each time you change. Restart Mach and you should be fine.
Hood
Re: g20/g21 and g70/g71 problems
« Reply #4 on: March 04, 2011, 07:49:14 PM »
That didn't work, everything is screwed up when I do that. Thanks anyway

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: g20/g21 and g70/g71 problems
« Reply #5 on: March 05, 2011, 04:58:46 AM »
Do you have steppers?
What microstepping are the drives?
Do you have gearing between screws and motors?
What is the pitch of the screws?
Hood
Re: g20/g21 and g70/g71 problems
« Reply #6 on: March 05, 2011, 12:32:51 PM »
I have steppers, don't know what microstep.

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: g20/g21 and g70/g71 problems
« Reply #7 on: March 05, 2011, 02:02:16 PM »
Then afraid I cant help unless you can give me the information needed to work things out.
Hood
Re: g20/g21 and g70/g71 problems
« Reply #8 on: March 06, 2011, 05:50:52 PM »
Ok thanks anyway.  Since it not really a problem if I leave out G20 I think I willl ignore it for a while.  Tried of chasing it now.

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: g20/g21 and g70/g71 problems
« Reply #9 on: March 06, 2011, 11:57:41 PM »
It is a problem because you are set up in Metric units as far as Mach is concerned and if your code ever has a G20 in it the path will be 25.4 times larger.

If you are certain that when you command a move of 1 inch it does move one inch then all you need to do is set the Native units as Inch. I however find this strange as if your unit in motor tuning is one inch then you only have a value of 548 for X and 534 for Y which means you must have a very course drive system, that is why I was thinking in a previous reply that when you changed the native units you would need to multiply the steps per unit by 25.4.
Hood