Hello Guest it is March 28, 2024, 06:44:42 AM

Author Topic: G Code Help  (Read 8417 times)

0 Members and 1 Guest are viewing this topic.

Offline AJA

*
  •  26 26
    • View Profile
G Code Help
« on: May 26, 2009, 09:05:08 PM »
I want to run this code 50 times and increment it in the Y axis in 0.100 increments.  How do I accomplish this?
Thanks
AJ

G00 X0 Y0 Z1
G01 Z0 F20
G18
G02 X-4 Z0 R3.4019
G17
G00 Z1

vmax549

*
Re: G Code Help
« Reply #1 on: May 26, 2009, 09:48:55 PM »
#2=0
M98 P100 L50
M30
%

o100
#1=.100
G00 X0 Y#2 Z1
G01 Z0 F20
G18
G02 X-4 Z0 R3.4019
G17
G00 Z1
#2=[#2+#1]
M99
%

Offline AJA

*
  •  26 26
    • View Profile
Re: G Code Help
« Reply #2 on: May 27, 2009, 07:48:24 PM »
Thanks vmax549,

Will you recommend a book which provides and explains examples in line by line form for the various g codes?  I use the Mach 3 user's guide but for a newbee it leaves some holes in the examples.
Thanks again
AJ

vmax549

*
Re: G Code Help
« Reply #3 on: May 27, 2009, 09:26:13 PM »
I can explain the above code if that helps,  what you were asking for went a little above basic Gcode(;-).

A good read is PeterSmid's    "CNC Programing, second edition"  BUT it can be quite a read for a beginner  BUT it does have a help CD encluded.  I still use it as a referrnece from time to time.

He does a good job of explaining.

IF you need a BASIC learner there is one on the WEB I'll try and track it down again and let you know.


THe book is: 
Easy CNC - A Beginners Guide to CNC

I have NOT read it myself but it does come recommended(;-)


(;-) TP
« Last Edit: May 27, 2009, 09:42:26 PM by vmax549 »

Offline AJA

*
  •  26 26
    • View Profile
Re: G Code Help
« Reply #4 on: May 29, 2009, 07:39:58 AM »
I understand the code as written, but noway would I have been able to place the lines in their correct order.

I have ordered both of the books which you recommended.  Perhaps some of their knowledge will be absorbed.

Thanks again
AJ
Re: G Code Help
« Reply #5 on: July 17, 2009, 04:36:18 PM »
I was taught to always use a % sign at the beginning  & the end of the program does this hold true for mach3

vmax549

*
Re: G Code Help
« Reply #6 on: July 17, 2009, 06:11:08 PM »
Not required but a good habit to be in.

(;-) TP

Offline Sam

*
  • *
  •  987 987
    • View Profile
    • hillbillyhilton.com
Re: G Code Help
« Reply #7 on: July 19, 2009, 04:01:16 AM »
In some instances, mach does indeed need the carriage return. The "%" is just a visual cue that the carriage return (or whatever it's called nowadays) is actually there. Definitely a good habit to be in.
"CONFIDENCE: it's the feeling you experience before you fully understand the situation."
Re: G Code Help
« Reply #8 on: July 24, 2009, 08:06:20 PM »
...if you need help decoding G-Code....

I wrote a web based G-Code commenter.  It adds plain English comments to G-Code.

http://www.eng-serve.com/cnc/gcode_comment.html

Input

Code: [Select]
#2=0
M98 P100 L50
M30
%

o100
#1=.100
G00 X0 Y#2 Z1
G01 Z0 F20
G18
G02 X-4 Z0 R3.4019
G17
G00 Z1
#2=[#2+#1]
M99
%

It returns...

Code: [Select]
#2=0 ( #: Variable Assignment:#2=0 )
M98 P100 L50 ( M98:Call subroutine P:Line Number:100  L:Number of repititions:50 )
M30 ( M30:End program...rewind stop )
% ( %: Start or end of program )

o100 ( O:Subroutine label number:100 )
#1=.100 ( #: Variable Assignment:#1=.100 )
G00 X0 Y#2 Z1 ( G00:Rapid positioning #: Variable Assignment:#2 Z1 )
G01 Z0 F20 ( G01:Linear interpolation F:Feedrate:20 )
G18 ( G18:X-Z plane sel )
G02 X-4 Z0 R3.4019 ( G02:CW circular interpolation R:Arc radius:3.4019 )
G17 ( G17:X-Y plane sel )
G00 Z1 ( G00:Rapid positioning )
#2=[#2+#1] ( #: Variable Assignment:#2=[#2+#1] )
M99 ( M99:Return from subroutine )
% ( %: Start or end of program )

Offline Fastest1

*
  •  920 920
  • Houston, TX
    • View Profile
Re: G Code Help
« Reply #9 on: October 14, 2009, 03:45:01 PM »
Wow thanks for the commenter. That is quite helpful.
I want to die in my sleep like my grandfather, not like the passengers in the car! :-)