CAD CAM EDM DRO - Yahoo Group Archive

re:Code behind the Code (g code)

Posted by ballendo@y...
on 2000-12-16 15:57:00 UTC
Wally6800 wrote:
>Since I have been a member of this group, I have tripped over "G"
>Code . I have asked people who are considered experts in CNC
>programming,"What is the code behind the code?". They haven't got a
>clue as to what is going on behind the code. They just use it
>because it works.
>Where can I find a source for the code behind the code? What is
>really being processed in the computer when the command G03 is being
>executed? Any body besides me interested?
>Is there anybody in this group that knows and would share that
>knowledge?

Wally,

Many people on this list 'have a clue' what is 'going on' behind the
gcode. The problem you may be running into is that what is going on
behind the scenes IS OFTEN VERY different in different programs which
process a gcode file! There are MANY methods of 'interpolating the
curve' of your G03 example...

Gcode is the result of IMPLEMENTING the EIA-RS274D standard. Rs274d
defines (sometimes poorly) what is 'supposed to' happen when certain
letters and numbers are found while processing a file. It also
specifies what format/structure the file 'should' have.

IT (RS-274D) DOES NOT specify HOW TO ACHIEVE the DESIRED result...
ONLY what the result should be... (again, sometimes poorly, IMO)

Also, like any good standard, there were 'holes' provided for new
developments. Since the last update of the standard was in 1981,
there have been many 'common-law'(means typical uses which have
developed over the years, and have become pseudo-standard) type
updates which are NOT reflected by the RS-274D text.

Now getting to your specific question:

Where to find out the behind the scenes info?

Two net-based sources are available. first, The stepster gcode
interpreter and controller at http://www.metalworking.com . This is
written in the computer language BASIC and an updated version is
maintained/developed by Charlie Gallo, who has an egroup devoted to
it: Stepstercnc . Also at metalworking.com, look for a file called
exactly... The full name of the paper is Exactly how a cnc control
works. This was written by Kevin Carrol, who originally developed the
Stepster program. Kevin Died last year.

Second, the EMC source. Start at http://www.linuxcnc.org and once you
get the EMC source code (which will be in the C computer programming
language) look for the files 274NGC.hh and 274NGC.CC. There are
comments in the code which may help you to see the behind the scenes
method used by the programmers of EMC.

Please note that NEITHER of these approaches to IMPLEMENTING
the 'gcode' standard EIA RS-274D are the BEST, or ONLY WAY!!!!
Rather, thay are two examples of how somebody did it. (and is doing
it?)

The luberth plotter site also has some code available. (do a search)

Some OLD books about NC and early CNC have chapters which go into
more detail than current CNC books, which almost always come from "an
operator programming a machine tool" perspective...

Also the older CNC control owners manuals contain more of the "guts"
of what is going on. Remember though, that most of the early controls
used HARDWARE solutions. Which will be difficult to interpret without
an electronics background.

Finally, You do not NEED to know how the computer code works, to use
it! You MAY find (I have), that many commercial CNC controllers do
not get it right. But again, there are holes and inconsistencies in
the original standard. Also a lot of "that doesn't make sense, I'll
do it this way..." And I know for a fact that several programmers
have relied on second or third hand info to create their controller...

Are you writing a control? Or just feeling that knowing what's
happening behind the scenes will let you be a better operator?

Hope this helps.

Ballendo

Discussion Thread

ballendo@y... 2000-12-16 15:57:00 UTC re:Code behind the Code (g code)