Popular Posts

Monday, November 8, 2010

G- Code and M-Code


What is G-Code?

  • G-code is the common name for the most widely used numerical control (NC) programming language, which has many implementations. This general sense of the term, referring to the language overall (using the mass sense of "code"), is imprecise, because it comes metonymically from the literal sense of the term, referring to one letter address among many in the language (G address, for preparatory commands) and to the specific codes (count sense) that can be formed with it (for example, G00, G01, G28). In fact, every letter of the English alphabet is used somewhere in the language, although some letters' use is less common.
  • The first implementation of numerical control was developed at the MIT Servomechanisms Laboratory in the early 1950s. In the decades since, many implementations have been developed by many organizations. G-code has often been used in these implementations. 
  • Extensions and variations have been added independently by control manufacturers and machine tool manufacturers, and operators of a specific controller must be aware of differences of each manufacturer's product. 
  • One standardized version of G-code, known as BCL, is used only on very few machines.
  • Some CNC machine manufacturers attempted to overcome compatibility difficulties by standardizing on machine tool controllers built by Fanuc. This semistandardization can be compared to other instances of market dominance, such as with IBM, Intel, or Microsoft. Pros and cons exist, and a wide variety of alternatives are available.
  • Some CNC machines use "conversational" programming, which is a wizard-like programming mode that either hides G-code or completely bypasses the use of G-code. Some popular examples are Southwestern Industries' ProtoTRAK, Mazak's Mazatrol, Hurco's Ultimax and Mori Seiki's CAPS conversational software.
  • G-code began as a limited type of language that lacked constructs such as loops, conditional operators, and programmer-declared variables with natural-word-including names (or the expressions in which to use them). It was thus unable to encode logic; it was essentially just a way to "connect the dots" where many of the dots' locations were figured out longhand by the programmer. The latest implementations of G-code include such constructs, creating a language somewhat closer to a high-level programming language. The more a programmer can tell the machine what end result is desired, and leave the intermediate calculations to the machine, the more s/he uses the machine's computational power to full advantage.

Specific codes

G-codes are also called preparatory codes, and are any word in a CNC program that begins with the letter "G". Generally it is a code telling the machine tool what type of action to perform, such as:
  • rapid move
  • controlled feed move in a straight line or arc
  • series of controlled feed moves that would result in a hole being bored, a workpiece cut (routed) to a specific dimension, or a decorative profile shape added to the edge of a workpiece.
  • set tool information such as offset.
List of G-codes commonly found on Fanuc and similarly designed controls
List of M-codes commonly found on Fanuc and similarly designed controls

                                                                                                                                        source : Wikipedia

No comments:

Post a Comment